From 8a6abab1dab04abf8ad7bd67b83d904347bab5d9 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 1 Nov 2022 19:55:30 +0100 Subject: [PATCH] Update the Github actions The Github actions need an update due to upcoming deprecations: * The 'set-output' command is deprecated [1]. Update to write to the GITHUB_OUTPUT environment file instead. * All Github actions using Node.js 12 are deprecated [2]. Update the following actions to a newer version using Node.js 16: - actions/checkout - actions/upload-artifact - microsoft/setup-msbuild * The Github create-release and upload-release-asset actions are no longer maintained. Replace with an alternative solution using the Github CLI. [1] https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ [2] https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/ --- .github/workflows/build.yml | 18 +++++++++--------- .github/workflows/release.yml | 32 +++++++++----------------------- 2 files changed, 18 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 161c2f3..a2bee25 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: CC: ${{ matrix.compiler }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install dependencies run: sudo apt-get install libbluetooth-dev libusb-1.0-0-dev - run: autoreconf --install --force @@ -30,7 +30,7 @@ jobs: run: | make install DESTDIR=$PWD/artifacts tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ github.job }}-${{ matrix.compiler }} path: ${{ github.job }}-${{ matrix.compiler }}.tar.gz @@ -50,7 +50,7 @@ jobs: CC: ${{ matrix.compiler }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install dependencies run: brew install autoconf automake libtool hidapi libusb - run: autoreconf --install --force @@ -61,7 +61,7 @@ jobs: run: | make install DESTDIR=$PWD/artifacts tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ github.job }}-${{ matrix.compiler }} path: ${{ github.job }}-${{ matrix.compiler }}.tar.gz @@ -78,7 +78,7 @@ jobs: arch: [i686, x86_64] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install dependencies run: sudo apt-get install gcc-mingw-w64 binutils-mingw-w64 mingw-w64-tools - name: Install libusb @@ -118,7 +118,7 @@ jobs: run: | make install DESTDIR=$PWD/artifacts tar -czf ${{ github.job }}-${{ matrix.arch }}.tar.gz -C artifacts usr - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ github.job }}-${{ matrix.arch }} path: ${{ github.job }}-${{ matrix.arch }}.tar.gz @@ -138,7 +138,7 @@ jobs: CONFIGURATION: Release steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: msys2/setup-msys2@v2 with: install: autoconf automake libtool pkg-config make gcc @@ -146,9 +146,9 @@ jobs: autoreconf --install --force ./configure --prefix=/usr shell: msys2 {0} - - uses: microsoft/setup-msbuild@v1.0.2 + - uses: microsoft/setup-msbuild@v1 - run: msbuild -m -p:Platform=${{ matrix.platform }} -p:Configuration=${{ env.CONFIGURATION }} msvc/libdivecomputer.vcxproj - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ github.job }}-${{ matrix.platform }} path: msvc/${{ matrix.platform }}/${{ env.CONFIGURATION }}/bin diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 37f578e..fcf8f23 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,19 +9,13 @@ jobs: name: Release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Version number id: version run: | VERSION="${GITHUB_REF/refs\/tags\/v/}" - if [ "${VERSION}" = "${VERSION%%-*}" ]; then - PRERELEASE=false - else - PRERELEASE=true - fi - echo ::set-output name=version::${VERSION} - echo ::set-output name=prerelease::${PRERELEASE} + echo "version=${VERSION}" >> $GITHUB_OUTPUT - name: Build distribution tarball id: build @@ -41,21 +35,13 @@ jobs: exit 1 fi - - uses: actions/create-release@v1 + - name: Create Github release id: release + run: | + VERSION="${{ steps.version.outputs.version }}" + if [ "${VERSION}" != "${VERSION%%-*}" ]; then + PRERELEASE="-p" + fi + gh release create ${PRERELEASE} "${{ github.ref }}" "libdivecomputer-${VERSION}.tar.gz" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - prerelease: ${{ steps.version.outputs.prerelease }} - - - uses: actions/upload-release-asset@v1 - id: upload - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.release.outputs.upload_url }} - asset_path: libdivecomputer-${{ steps.version.outputs.version }}.tar.gz - asset_name: libdivecomputer-${{ steps.version.outputs.version }}.tar.gz - asset_content_type: application/gzip