Skip to content

Commit 8470864

Browse files
committed
chore: update release workflow
1 parent 30d5459 commit 8470864

2 files changed

Lines changed: 12 additions & 72 deletions

File tree

.github/workflows/release.yaml

Lines changed: 7 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,100 +2,37 @@ on:
22
workflow_dispatch:
33
inputs:
44
logLevel:
5-
description: 'Log level'
5+
description: "Log level"
66
required: true
7-
default: 'warning'
7+
default: "warning"
88
type: choice
99
options:
1010
- info
1111
- warning
1212
- debug
1313
tags:
14-
description: 'Tags'
14+
description: "Tags"
1515
required: false
1616
type: boolean
1717
release:
1818
types: [created]
1919

2020
jobs:
21-
releases:
21+
release:
2222
name: Release Authorizer
2323
runs-on: ubuntu-latest
2424
steps:
2525
- uses: actions/checkout@v4
26-
- uses: actions/setup-node@v4
27-
with:
28-
node-version: '20'
29-
- name: Set up QEMU
30-
uses: docker/setup-qemu-action@v3
3126
- name: Set up Docker Buildx
3227
uses: docker/setup-buildx-action@v3
3328
with:
3429
platforms: linux/amd64,linux/arm64
35-
- uses: actions/setup-go@v5
36-
with:
37-
go-version: '1.24'
38-
- name: Install dependencies
39-
run: |
40-
sudo apt-get install -y build-essential wget zip && \
41-
wget --no-check-certificate --progress=dot:mega https://github.com/wangyoucao577/assets-uploader/releases/download/v0.3.0/github-assets-uploader-v0.3.0-linux-amd64.tar.gz -O github-assets-uploader.tar.gz && \
42-
tar -zxf github-assets-uploader.tar.gz && \
43-
sudo mv github-assets-uploader /usr/sbin/ && \
44-
rm -f github-assets-uploader.tar.gz && \
45-
github-assets-uploader -version
46-
- name: Build web app and dashboard
47-
run: |
48-
make build-app
49-
make build-dashboard
50-
- name: Install gox
51-
run: go install github.com/mitchellh/gox@latest
52-
- name: Set VERSION env
53-
run: echo VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}
54-
- name: Build package
55-
run: |
56-
make clean
57-
make build
58-
for arch in darwin-arm64 darwin-amd64 linux-amd64 linux-arm64; do
59-
os=$(echo $arch | cut -d- -f1)
60-
cpu=$(echo $arch | cut -d- -f2)
61-
dir=authorizer-${VERSION}-${arch}
62-
mkdir -p $dir/web/app $dir/web/dashboard $dir/web/templates
63-
cp build/${os}/${cpu}/authorizer $dir/
64-
cp .env.sample $dir/
65-
cp -rf web/app/build $dir/web/app/
66-
cp -rf web/app/favicon_io $dir/web/app/
67-
cp -rf web/dashboard/build $dir/web/dashboard/
68-
cp -rf web/dashboard/favicon_io $dir/web/dashboard/
69-
cp -rf web/dashboard/public $dir/web/dashboard/ 2>/dev/null || true
70-
cp -rf web/templates/* $dir/web/templates/
71-
tar cvfz authorizer-${VERSION}-${arch}.tar.gz $dir
72-
done
73-
- name: Upload assets
74-
run: |
75-
github-assets-uploader -f authorizer-${VERSION}-darwin-arm64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
76-
github-assets-uploader -f authorizer-${VERSION}-darwin-amd64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
77-
github-assets-uploader -f authorizer-${VERSION}-linux-amd64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
78-
github-assets-uploader -f authorizer-${VERSION}-linux-arm64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
7930
- name: Log in to Docker Hub
8031
uses: docker/login-action@v3
8132
with:
8233
username: ${{ secrets.DOCKER_USERNAME }}
8334
password: ${{ secrets.DOCKER_PASSWORD }}
84-
- name: Extract metadata (tags, labels) for Docker
85-
id: meta
86-
uses: docker/metadata-action@v5
87-
with:
88-
images: authorizerdev/authorizer
89-
tags: |
90-
type=ref,event=tag
91-
type=ref,event=pr
9235
- name: Build and push Docker image
93-
uses: docker/build-push-action@v5
94-
with:
95-
context: .
96-
push: true
97-
tags: ${{ steps.meta.outputs.tags }}
98-
labels: ${{ steps.meta.outputs.labels }}
99-
platforms: linux/amd64,linux/arm64
100-
build-args: |
101-
VERSION=${{ env.VERSION }}
36+
run: |
37+
VERSION=$(basename ${GITHUB_REF})
38+
make build-push-image VERSION=${VERSION} DOCKER_IMAGE=lakhansamani/authorizer:${VERSION}

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ build-dashboard:
2424
cd web/dashboard && npm ci && npm run build
2525
build-local-image:
2626
docker build --build-arg VERSION=$(VERSION) -t $(DOCKER_IMAGE) .
27-
build-push-image: build-local-image
28-
docker push $(DOCKER_IMAGE)
27+
build-push-image:
28+
docker buildx build --platform linux/amd64,linux/arm64 --push \
29+
-t $(DOCKER_IMAGE) \
30+
--build-arg VERSION=$(VERSION) \
31+
.
2932
clean:
3033
rm -rf build
3134
dev:

0 commit comments

Comments
 (0)