aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/trigger_release.yml
blob: 149cb63252429c3336c9f87c51a9fcf1883909fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Build Application and Make Release

on:
  push:
    tags:
      - '*'

jobs:

  build_release:
    name: Build Release
    uses: ./.github/workflows/build.yml
    with:
      build_type: Release

  create_release:
    needs: build_release
    runs-on: ubuntu-latest
    outputs:
      upload_url: ${{ steps.create_release.outputs.upload_url }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          submodules: 'true'
          path: 'PolyMC-source'
      - name: Download artifacts
        uses: actions/download-artifact@v3
      - name: Grab and store version
        run: |
          tag_name=$(echo ${{ github.ref }} | grep -oE "[^/]+$")
          echo "VERSION=$tag_name" >> $GITHUB_ENV
      - name: Package artifacts properly
        run: |
          mv ${{ github.workspace }}/PolyMC-source PolyMC-${{ env.VERSION }}
          mv PolyMC-Linux*/PolyMC.tar.gz PolyMC-Linux-${{ env.VERSION }}.tar.gz
          mv PolyMC-*.AppImage/PolyMC-*.AppImage PolyMC-Linux-${{ env.VERSION }}-x86_64.AppImage
          mv PolyMC-macOS*/PolyMC.tar.gz PolyMC-macOS-${{ env.VERSION }}.tar.gz

          tar -czf PolyMC-${{ env.VERSION }}.tar.gz PolyMC-${{ env.VERSION }}

          for d in PolyMC-Windows-*; do
            cd "${d}" || continue
            ARCH="$(echo -n ${d} | cut -d '-' -f 3)"
            PORT="$(echo -n ${d} | grep -o portable || true)"
            NAME="PolyMC-Windows-${ARCH}"
            test -z "${PORT}" || NAME="${NAME}-portable"
            zip -r -9 "../${NAME}-${{ env.VERSION }}.zip" *
            cd ..
          done

      - name: Create release
        id: create_release
        uses: softprops/action-gh-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          name: PolyMC ${{ env.VERSION }}
          draft: true
          prerelease: false
          files: |
            PolyMC-Linux-${{ env.VERSION }}.tar.gz
            PolyMC-Linux-${{ env.VERSION }}-x86_64.AppImage
            PolyMC-Windows-i686-${{ env.VERSION }}.zip
            PolyMC-Windows-i686-portable-${{ env.VERSION }}.zip
            PolyMC-Windows-x86_64-${{ env.VERSION }}.zip
            PolyMC-Windows-x86_64-portable-${{ env.VERSION }}.zip
            PolyMC-macOS-${{ env.VERSION }}.tar.gz
            PolyMC-${{ env.VERSION }}.tar.gz