|
2 | 2 | workflow_dispatch: |
3 | 3 | inputs: |
4 | 4 | logLevel: |
5 | | - description: 'Log level' |
| 5 | + description: "Log level" |
6 | 6 | required: true |
7 | | - default: 'warning' |
| 7 | + default: "warning" |
8 | 8 | type: choice |
9 | 9 | options: |
10 | 10 | - info |
11 | 11 | - warning |
12 | 12 | - debug |
13 | 13 | tags: |
14 | | - description: 'Tags' |
| 14 | + description: "Tags" |
15 | 15 | required: false |
16 | 16 | type: boolean |
17 | 17 | release: |
18 | 18 | types: [created] |
19 | 19 |
|
20 | 20 | jobs: |
21 | | - releases: |
| 21 | + release: |
22 | 22 | name: Release Authorizer |
23 | 23 | runs-on: ubuntu-latest |
24 | 24 | steps: |
25 | 25 | - 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 |
31 | 26 | - name: Set up Docker Buildx |
32 | 27 | uses: docker/setup-buildx-action@v3 |
33 | 28 | with: |
34 | 29 | 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} |
79 | 30 | - name: Log in to Docker Hub |
80 | 31 | uses: docker/login-action@v3 |
81 | 32 | with: |
82 | 33 | username: ${{ secrets.DOCKER_USERNAME }} |
83 | 34 | 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 |
92 | 35 | - 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} |
0 commit comments