Build and Publish Release #123
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: Build and Publish Release | |
on: | |
push: | |
branches: | |
- dev | |
release: | |
types: [published] | |
jobs: | |
build-and-push-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- | |
name: Get Tag Name | |
id: vars | |
shell: bash | |
run: | | |
echo "##[set-output name=tag_name;]$(echo ${GITHUB_REF#refs/heads/}-$(date +'%Y%m%d')$(git rev-parse --short HEAD))" | |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
- name: Use Node.js 15 | |
uses: actions/setup-node@v2-beta | |
with: | |
node-version: '15' | |
check-latest: true | |
- run: yarn | |
working-directory: frontend | |
- run: yarn run build | |
working-directory: frontend | |
env: | |
REACT_APP_VERSION: ${{ github.event.release.tag_name || steps.vars.outputs.tag_name }} | |
NODE_ENV: production | |
- | |
name: Build and Publish Frontend ${{ github.event.release.tag_name || steps.vars.outputs.tag_name }} | |
id: docker_build_frontend_tagged_version | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: leishi1313/aurora-admin-frontend:${{ github.event.release.tag_name || steps.vars.outputs.tag_name }} | |
- | |
if: github.event_name == 'release' | |
name: Build and Publish Frontend Latest | |
id: docker_build_frontend_latest | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: leishi1313/aurora-admin-frontend:latest | |
- | |
if: github.event_name != 'release' | |
name: Build and Publish Frontend Dev Latest | |
id: docker_build_frontend_test_latest | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: leishi1313/aurora-admin-frontend:${{ steps.vars.outputs.branch }}-latest | |
- | |
name: Frontend digest | |
run: echo ${{ steps.docker_build_frontend_tagged_version.outputs.digest }} | |
build-and-push-backend: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- | |
name: Get Tag Name | |
id: vars | |
shell: bash | |
run: | | |
echo "##[set-output name=tag_name;]$(echo ${GITHUB_REF#refs/heads/}-$(git rev-parse --short HEAD))" | |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
- | |
name: Build and Publish Backend ${{ github.event.release.tag_name || steps.vars.outputs.tag_name }} | |
id: docker_build_backend_tagged_version | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./backend | |
file: ./backend/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: leishi1313/aurora-admin-backend:${{ github.event.release.tag_name || steps.vars.outputs.tag_name }} | |
build-args: | | |
BACKEND_APP_VERSION=${{ github.event.release.tag_name || steps.vars.outputs.tag_name }} | |
- | |
if: github.event_name == 'release' | |
name: Build and Publish Backend Latest | |
id: docker_build_backend_latest | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./backend | |
file: ./backend/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: leishi1313/aurora-admin-backend:latest | |
build-args: | | |
BACKEND_APP_VERSION=${{ github.event.release.tag_name || steps.vars.outputs.tag_name }} | |
- | |
if: github.event_name != 'release' | |
name: Build and Publish Backend Dev Latest | |
id: docker_build_backend_test_latest | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./backend | |
file: ./backend/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: leishi1313/aurora-admin-backend:${{ steps.vars.outputs.branch }}-latest | |
build-args: | | |
BACKEND_APP_VERSION=${{ github.event.release.tag_name || steps.vars.outputs.tag_name }} | |
- | |
name: Backend digest | |
run: echo ${{ steps.docker_build_backend_tagged_version.outputs.digest }} | |
- name: Send message to Telegram | |
uses: Lukasss93/telegram-action@v2 | |
env: | |
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
TELEGRAM_CHAT: ${{ secrets.TELEGRAM_CHAT }} |