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/
This commit is contained in:
Jef Driesen 2022-11-01 19:55:30 +01:00
parent 005a2501b9
commit 8a6abab1da
2 changed files with 18 additions and 32 deletions

View File

@ -19,7 +19,7 @@ jobs:
CC: ${{ matrix.compiler }} CC: ${{ matrix.compiler }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Install dependencies - name: Install dependencies
run: sudo apt-get install libbluetooth-dev libusb-1.0-0-dev run: sudo apt-get install libbluetooth-dev libusb-1.0-0-dev
- run: autoreconf --install --force - run: autoreconf --install --force
@ -30,7 +30,7 @@ jobs:
run: | run: |
make install DESTDIR=$PWD/artifacts make install DESTDIR=$PWD/artifacts
tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v3
with: with:
name: ${{ github.job }}-${{ matrix.compiler }} name: ${{ github.job }}-${{ matrix.compiler }}
path: ${{ github.job }}-${{ matrix.compiler }}.tar.gz path: ${{ github.job }}-${{ matrix.compiler }}.tar.gz
@ -50,7 +50,7 @@ jobs:
CC: ${{ matrix.compiler }} CC: ${{ matrix.compiler }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Install dependencies - name: Install dependencies
run: brew install autoconf automake libtool hidapi libusb run: brew install autoconf automake libtool hidapi libusb
- run: autoreconf --install --force - run: autoreconf --install --force
@ -61,7 +61,7 @@ jobs:
run: | run: |
make install DESTDIR=$PWD/artifacts make install DESTDIR=$PWD/artifacts
tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v3
with: with:
name: ${{ github.job }}-${{ matrix.compiler }} name: ${{ github.job }}-${{ matrix.compiler }}
path: ${{ github.job }}-${{ matrix.compiler }}.tar.gz path: ${{ github.job }}-${{ matrix.compiler }}.tar.gz
@ -78,7 +78,7 @@ jobs:
arch: [i686, x86_64] arch: [i686, x86_64]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Install dependencies - name: Install dependencies
run: sudo apt-get install gcc-mingw-w64 binutils-mingw-w64 mingw-w64-tools run: sudo apt-get install gcc-mingw-w64 binutils-mingw-w64 mingw-w64-tools
- name: Install libusb - name: Install libusb
@ -118,7 +118,7 @@ jobs:
run: | run: |
make install DESTDIR=$PWD/artifacts make install DESTDIR=$PWD/artifacts
tar -czf ${{ github.job }}-${{ matrix.arch }}.tar.gz -C artifacts usr tar -czf ${{ github.job }}-${{ matrix.arch }}.tar.gz -C artifacts usr
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v3
with: with:
name: ${{ github.job }}-${{ matrix.arch }} name: ${{ github.job }}-${{ matrix.arch }}
path: ${{ github.job }}-${{ matrix.arch }}.tar.gz path: ${{ github.job }}-${{ matrix.arch }}.tar.gz
@ -138,7 +138,7 @@ jobs:
CONFIGURATION: Release CONFIGURATION: Release
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2 - uses: msys2/setup-msys2@v2
with: with:
install: autoconf automake libtool pkg-config make gcc install: autoconf automake libtool pkg-config make gcc
@ -146,9 +146,9 @@ jobs:
autoreconf --install --force autoreconf --install --force
./configure --prefix=/usr ./configure --prefix=/usr
shell: msys2 {0} 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 - 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: with:
name: ${{ github.job }}-${{ matrix.platform }} name: ${{ github.job }}-${{ matrix.platform }}
path: msvc/${{ matrix.platform }}/${{ env.CONFIGURATION }}/bin path: msvc/${{ matrix.platform }}/${{ env.CONFIGURATION }}/bin

View File

@ -9,19 +9,13 @@ jobs:
name: Release name: Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Version number - name: Version number
id: version id: version
run: | run: |
VERSION="${GITHUB_REF/refs\/tags\/v/}" VERSION="${GITHUB_REF/refs\/tags\/v/}"
if [ "${VERSION}" = "${VERSION%%-*}" ]; then echo "version=${VERSION}" >> $GITHUB_OUTPUT
PRERELEASE=false
else
PRERELEASE=true
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=prerelease::${PRERELEASE}
- name: Build distribution tarball - name: Build distribution tarball
id: build id: build
@ -41,21 +35,13 @@ jobs:
exit 1 exit 1
fi fi
- uses: actions/create-release@v1 - name: Create Github release
id: 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: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 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