diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fdee9ee083..0297b8eb87 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,6 +4,8 @@ on: push: branches: - "master" + tags: + - "*" paths-ignore: - "**.md" pull_request: @@ -33,6 +35,9 @@ jobs: os: macos-latest compiler: clang shell: bash + artifacts: true + pkg-path: pkg/osx/*.dmg + pkg-dir: pkg/osx - name: MSYS2 UCRT64 os: windows-latest @@ -40,6 +45,9 @@ jobs: shell: 'msys2 {0}' msystem: ucrt64 msys-env: mingw-w64-ucrt-x86_64 + artifacts: true + pkg-path: pkg/win32/*.zip + pkg-dir: pkg/win32 - name: MSYS2 MINGW32 os: windows-latest @@ -47,6 +55,9 @@ jobs: shell: 'msys2 {0}' msystem: mingw32 msys-env: mingw-w64-i686 + artifacts: true + pkg-path: pkg/win32/*.zip + pkg-dir: pkg/win32 steps: - name: Install pandoc @@ -115,28 +126,30 @@ jobs: PREFIX=`sed -n '/PROGRAM_PREFIX/p' ${PWD}/config.h | cut -d '"' -f 2` make -j4 -C quickcheck check SOURCE_PORT=$PWD/src/${PREFIX}doom - - name: Package (macOS) - if: runner.os == 'macOS' - run: | - cd pkg/osx - make - - - name: Package (MSYS2) - if: runner.os == 'Windows' + - name: Package + if: ${{ matrix.config.artifacts }} run: | - cd pkg/win32 + cd ${{ matrix.config.pkg-dir }} make - - name: Upload artifacts (macOS) - if: runner.os == 'macOS' + - name: Upload artifacts + if: ${{ matrix.config.artifacts }} uses: actions/upload-artifact@v3 with: - name: macOS - path: pkg/osx/*.dmg + name: ${{ matrix.config.name }} + path: ${{ matrix.config.pkg-path }} - - name: Upload artifacts (MSYS2) - if: runner.os == 'Windows' - uses: actions/upload-artifact@v3 + - name: Extract Package String + if: ${{ contains(github.ref, 'tags') }} + run: | + PACKAGE_STRING=`sed -n '/PACKAGE_STRING/p' ${PWD}/config.h | cut -d '"' -f 2` + echo "PACKAGE_STRING=${PACKAGE_STRING}" >> $GITHUB_ENV + + - name: Release + if: ${{ contains(github.ref, 'tags') && matrix.config.artifacts }} + uses: ncipollo/release-action@v1 with: - name: Win-${{ matrix.config.msystem }} - path: pkg/win32/*.zip + name: ${{ env.PACKAGE_STRING }} + bodyFile: CHANGELOG.md + allowUpdates: true + artifacts: ${{ matrix.config.pkg-path }}