v3.3.2 #25
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
#触发机制,当创建tag时 | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
frontend-builder: | |
name: frontend-builder | |
runs-on: ubuntu-latest | |
steps: | |
- name: SetOutput | |
id: vars | |
run: echo "tag=${GITHUB_REF#refs/*/v}" >> $GITHUB_OUTPUT | |
- name: Checkout #Checkout代码 | |
uses: actions/checkout@v3 | |
- name: Set up Node | |
uses: actions/[email protected] | |
with: | |
node-version: '16' | |
- name: Yarn install | |
run: | | |
cd frontend && rm -f yarn.lock && yarn install --registry https://registry.npmmirror.com --legacy-peer-deps | |
yarn build | |
- name: print files | |
run: | | |
pwd | |
ls -l ./ | |
ls -l controller/ | |
- name: upload frontend release | |
uses: actions/upload-artifact@v2 | |
with: | |
name: apserver-frontend | |
path: frontend/dist | |
release: | |
needs: [frontend-builder] | |
name: release | |
runs-on: ubuntu-latest | |
steps: | |
- name: SetOutput #处理Tag字符串并存进outputs | |
id: vars | |
run: | | |
echo "tag=${GITHUB_REF#refs/*/v}" >> $GITHUB_OUTPUT | |
- name: Checkout #Checkout代码 | |
uses: actions/checkout@v3 | |
- name: download frontend release | |
uses: actions/download-artifact@v2 | |
with: | |
name: apserver-frontend | |
path: frontend/dist | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.19.4' | |
- name: Go tidy | |
run: | | |
go mod tidy | |
echo "GOVERSION=$(go version)" >> $GITHUB_ENV | |
- name: Create archives on Release #创建各种系统架构下的二进制包并上传至release assets | |
uses: goreleaser/[email protected] | |
with: | |
version: latest | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: print file | |
run: | | |
echo v${{ steps.vars.outputs.tag }} | |
ls -l apinto-build/ | |
- name: upload release | |
uses: actions/upload-artifact@v2 | |
with: | |
name: apinto-dashboard-release | |
path: apinto-build/apserver_v${{ steps.vars.outputs.tag }}_linux_amd64.tar.gz | |
docker-push: | |
needs: [release] | |
name: docker-push | |
runs-on: ubuntu-latest | |
steps: | |
- name: SetOutput | |
id: vars | |
run: echo "tag=${GITHUB_REF#refs/*/v}" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v3 | |
- name: Login Docker #登录docker | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: download release | |
uses: actions/download-artifact@v2 | |
with: | |
name: apinto-dashboard-release | |
path: scripts/apserver_v${{ steps.vars.outputs.tag }}_linux_amd64.tar.gz | |
- name: build | |
run: cd scripts && docker build --build-arg VERSION="v${{ steps.vars.outputs.tag }}" --build-arg APP="apserver" --build-arg DIR="." -t ${{ secrets.DOCKER_USERNAME }}/apinto-dashboard:${{ steps.vars.outputs.tag }} ./ | |
- name: push image | |
run: | | |
docker push ${{ secrets.DOCKER_USERNAME }}/apinto-dashboard:${{ steps.vars.outputs.tag }} | |
docker tag ${{ secrets.DOCKER_USERNAME }}/apinto-dashboard:${{ steps.vars.outputs.tag }} ${{ secrets.DOCKER_USERNAME }}/apinto-dashboard:latest | |
docker push ${{ secrets.DOCKER_USERNAME }}/apinto-dashboard:latest |