ci: update more gh actions versions #208
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: Production Dex UI Pipeline | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [created] | |
env: | |
ENV: 'prd' | |
APP: 'dex-ui' | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
name: Web build docker | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 100 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: GoogleCloudPlatform/release-please-action@v3 | |
id: release | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: node | |
package-name: '' | |
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"ci","section":"CI / CD","hidden":false},{"type":"test","section":"Testing","hidden":false},{"type":"refactor","section":"Refactorings","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]' | |
- name: Set up Docker Buildx | |
id: buildx | |
# Use the action from the master, as we've seen some inconsistencies with @v1 | |
# Issue: https://github.com/docker/build-push-action/issues/286 | |
uses: docker/setup-buildx-action@master | |
# Only worked for us with this option on �♂️ | |
with: | |
install: true | |
- name: Cache Docker layers | |
uses: actions/[email protected] | |
with: | |
path: /tmp/.buildx-cache | |
# Key is named differently to avoid collision | |
key: ${{ runner.os }}-${{ env.ENV }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-${{ env.ENV }}-buildx | |
- name: Log in to dockerhub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PASS }} | |
- name: Get commit sha on push | |
if: github.event_name == 'push' | |
id: git-sha | |
shell: bash | |
run: | | |
echo GIT_SHA=$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT | |
- name: Extract metadata for docker | |
if: | | |
github.event_name == 'push' || | |
startsWith(github.ref, 'refs/tags/v') | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: aeternity/dex-ui | |
tags: | | |
type=raw,value=latest,enable=${{ endsWith(GitHub.ref, 'main') }} | |
type=raw,value=main,enable=${{ endsWith(GitHub.ref, 'main') }} | |
type=raw,value=${{ steps.release.outputs.tag_name }},enable=${{ endsWith(GitHub.ref, 'main') }} | |
type=ref,event=tag | |
type=ref,event=pr | |
- name: Build and push docker image | |
if: | | |
github.event_name == 'push' || | |
startsWith(github.ref, 'refs/tags/v') | |
uses: docker/[email protected] | |
with: | |
context: . | |
file: Dockerfile | |
build-args: | | |
VUE_APP_MAINNET_DEX_BACKEND_URL="https://dex-backend-mainnet.prd.service.aepps.com" | |
VUE_APP_TESTNET_DEX_BACKEND_URL="https://dex-backend-testnet.prd.service.aepps.com" | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
# Note the mode=max here | |
# More: https://github.com/moby/buildkit#--export-cache-options | |
# And: https://github.com/docker/buildx#--cache-tonametypetypekeyvalue | |
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new | |
- name: Move cache | |
if: github.event_name == 'pull_request' && github.event.action == 'opened' || github.event.action == 'synchronize' | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
- uses: actions/checkout@v3 | |
with: | |
repository: aeternity/gitops-apps-aelabs.git | |
ref: prd | |
token: ${{ secrets.BOT_GITHUB_TOKEN }} | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Production Deploy | |
if: ${{ steps.release.outputs.release_created }} | |
uses: aeternity/ae-github-actions/argocd-deploy@v4 | |
with: | |
url-prefix: ${{ steps.release.outputs.tag_name }} | |
env: ${{ env.ENV }} | |
app: ${{ env.APP }} | |
- name: Latest Main Deploy on Push | |
if: github.event_name == 'push' | |
uses: aeternity/ae-github-actions/argocd-pr-sync@v4 | |
with: | |
git-sha: ${{ steps.git-sha.outputs.GIT_SHA }} | |
url-prefix: main | |
env: ${{ env.ENV }} | |
app: ${{ env.APP }} | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
repository: aeternity/gitops-apps-aelabs | |
github_token: ${{ secrets.BOT_GITHUB_TOKEN }} | |
branch: prd |