Skip to content

Commit 2e3c5dc

Browse files
committed
Upgrade GitHub Actions
Fixes deprecated set-output actions, upgrades Docker actions. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent c6cc226 commit 2e3c5dc

File tree

2 files changed

+31
-46
lines changed

2 files changed

+31
-46
lines changed

.github/workflows/build.yaml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,38 @@ on:
1010

1111
jobs:
1212
build:
13-
strategy:
14-
matrix:
15-
go-version: [ 1.17.x ]
16-
os: [ ubuntu-latest ]
17-
runs-on: ${{ matrix.os }}
13+
runs-on: ubuntu-latest
1814
steps:
1915
- uses: actions/checkout@master
2016
with:
2117
fetch-depth: 1
2218
- name: Install Go
23-
uses: actions/setup-go@v2
19+
uses: actions/setup-go@master
2420
with:
25-
go-version: ${{ matrix.go-version }}
21+
go-version: 1.19.x
2622
- name: Make all
2723
run: make all
2824

25+
- name: Get TAG
26+
id: get_tag
27+
run: echo TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV
28+
2929
- name: Get Repo Owner
3030
id: get_repo_owner
31-
run: >
32-
echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} |
33-
tr '[:upper:]' '[:lower:]')
34-
- name: Get Repo Name
35-
id: get_repo_name
36-
run: >
37-
echo ::set-output name=repo_name::$(echo ${{ github.repository }} |
38-
tr '[:upper:]' '[:lower:]' |
39-
awk -F'/' '{print $2}')
31+
run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" > $GITHUB_ENV
4032

4133
- name: Set up QEMU
42-
uses: docker/setup-qemu-action@v1
34+
uses: docker/setup-qemu-action@v2
4335
- name: Set up Docker Buildx
44-
uses: docker/setup-buildx-action@v1
36+
uses: docker/setup-buildx-action@v2
4537

4638
- name: Test and Build multiarch
4739
id: docker_build
48-
uses: docker/build-push-action@v2
40+
uses: docker/build-push-action@v3
4941
with:
5042
context: ./
5143
file: ./Dockerfile
5244
outputs: "type=image,push=false"
5345
platforms: linux/amd64,linux/arm64,linux/arm/v7
5446
tags: |
55-
ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ steps.get_repo_name.outputs.repo_name }}:${{ github.sha }}
47+
ghcr.io/${{ env.REPO_OWNER }}/classic-watchdog:${{ github.sha }}

.github/workflows/publish.yaml

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,72 +7,65 @@ on:
77

88
jobs:
99
publish:
10-
strategy:
11-
matrix:
12-
go-version: [ 1.17.x ]
13-
os: [ ubuntu-latest ]
14-
runs-on: ${{ matrix.os }}
10+
runs-on: ubuntu-latest
1511
permissions:
1612
contents: write
17-
actions: read
1813
checks: write
14+
15+
actions: read
1916
issues: read
2017
packages: write
2118
pull-requests: read
2219
repository-projects: read
2320
statuses: read
21+
2422
steps:
2523
- uses: actions/checkout@master
2624
with:
2725
fetch-depth: 1
2826
- name: Install Go
29-
uses: actions/setup-go@v2
27+
uses: actions/setup-go@master
3028
with:
31-
go-version: ${{ matrix.go-version }}
29+
go-version: 1.19.x
30+
3231
- name: Make all
3332
run: make all
3433

3534
- name: Get TAG
3635
id: get_tag
37-
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
36+
run: echo TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV
37+
3838
- name: Get Repo Owner
3939
id: get_repo_owner
40-
run: >
41-
echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} |
42-
tr '[:upper:]' '[:lower:]')
43-
- name: Get Repo Name
44-
id: get_repo_name
45-
run: >
46-
echo ::set-output name=repo_name::$(echo ${{ github.repository }} |
47-
tr '[:upper:]' '[:lower:]' |
48-
awk -F'/' '{print $2}')
40+
run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" > $GITHUB_ENV
4941

5042
- name: Set up QEMU
51-
uses: docker/setup-qemu-action@v1
43+
uses: docker/setup-qemu-action@v2
5244
- name: Set up Docker Buildx
53-
uses: docker/setup-buildx-action@v1
45+
uses: docker/setup-buildx-action@v2
5446

5547
- name: Login to Docker Registry
56-
uses: docker/login-action@v1
48+
uses: docker/login-action@v2
5749
with:
5850
username: ${{ github.repository_owner }}
5951
password: ${{ secrets.GITHUB_TOKEN }}
6052
registry: ghcr.io
6153

6254
- name: Build and push
6355
id: docker_build
64-
uses: docker/build-push-action@v2
56+
uses: docker/build-push-action@v3
6557
with:
6658
context: ./
6759
file: ./Dockerfile
6860
push: true
6961
platforms: linux/amd64,linux/arm64,linux/arm/v7
7062
tags: |
71-
ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ steps.get_repo_name.outputs.repo_name }}:${{ github.sha }}
72-
ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ steps.get_repo_name.outputs.repo_name }}:${{ steps.get_tag.outputs.TAG }}
73-
ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ steps.get_repo_name.outputs.repo_name }}:latest
63+
ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/classic-watchdog:${{ github.sha }}
64+
ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/classic-watchdog:${{ steps.get_tag.outputs.TAG }}
65+
ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/classic-watchdog:latest
66+
7467
- name: Upload release binaries
75-
uses: alexellis/upload-assets@0.2.2
68+
uses: alexellis/upload-assets@0.4.0
7669
env:
7770
GITHUB_TOKEN: ${{ github.token }}
7871
with:

0 commit comments

Comments
 (0)