|
| 1 | +name: Production Bridge And Swap Pipeline |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + release: |
| 8 | + types: [created] |
| 9 | + |
| 10 | +env: |
| 11 | + ENV: 'prd' |
| 12 | + APP: "aepp-bridge-and-swap" |
| 13 | + |
| 14 | +jobs: |
| 15 | + main: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + name: Web build docker |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + with: |
| 21 | + fetch-depth: 100 |
| 22 | + ref: ${{ github.event.pull_request.head.sha }} |
| 23 | + |
| 24 | + - uses: GoogleCloudPlatform/release-please-action@v3 |
| 25 | + id: release |
| 26 | + with: |
| 27 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 28 | + release-type: node |
| 29 | + package-name: '' |
| 30 | + 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}]' |
| 31 | + |
| 32 | + - name: Set up Docker Buildx |
| 33 | + id: buildx |
| 34 | + uses: docker/setup-buildx-action@master |
| 35 | + with: |
| 36 | + install: true |
| 37 | + |
| 38 | + - name: Log in to dockerhub |
| 39 | + |
| 40 | + with: |
| 41 | + username: ${{ secrets.DOCKERHUB_USER }} |
| 42 | + password: ${{ secrets.DOCKERHUB_PASS }} |
| 43 | + |
| 44 | + - name: Extract metadata for docker |
| 45 | + if: | |
| 46 | + github.event_name == 'push' || |
| 47 | + startsWith(github.ref, 'refs/tags/v') |
| 48 | + id: meta |
| 49 | + |
| 50 | + with: |
| 51 | + images: aeternity/aepp-bridge-and-swap |
| 52 | + tags: | |
| 53 | + type=raw,value=latest,enable=${{ endsWith(GitHub.ref, 'main') }} |
| 54 | + type=raw,value=main,enable=${{ endsWith(GitHub.ref, 'main') }} |
| 55 | + type=raw,value=${{ steps.release.outputs.tag_name }},enable=${{ endsWith(GitHub.ref, 'main') }} |
| 56 | + type=ref,event=tag |
| 57 | + type=ref,event=pr |
| 58 | +
|
| 59 | + - name: Build and push docker image |
| 60 | + if: | |
| 61 | + github.event_name == 'push' || |
| 62 | + startsWith(github.ref, 'refs/tags/v') |
| 63 | + |
| 64 | + with: |
| 65 | + context: . |
| 66 | + file: Dockerfile |
| 67 | + push: true |
| 68 | + tags: ${{ steps.meta.outputs.tags }} |
| 69 | + labels: ${{ steps.meta.outputs.labels }} |
| 70 | + cache-from: type=local,src=/tmp/.buildx-cache |
| 71 | + cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new |
| 72 | + platforms: linux/amd64 |
| 73 | + secrets: | |
| 74 | + "GITHUB_TOKEN=${{ secrets.BOT_GITHUB_TOKEN }}" |
| 75 | + build-args: | |
| 76 | + NEXT_PUBLIC_MAINNET=${{ secrets.NEXT_PUBLIC_MAINNET }} |
| 77 | + NEXT_PUBLIC_AE_PRIVATE_KEY=${{ secrets.NEXT_PUBLIC_AE_PRIVATE_KEY }} |
| 78 | + NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=${{ secrets.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID }} |
| 79 | +
|
| 80 | + - uses: actions/checkout@v3 |
| 81 | + with: |
| 82 | + repository: aeternity/gitops-apps.git |
| 83 | + ref: prd |
| 84 | + token: ${{ secrets.BOT_GITHUB_TOKEN }} |
| 85 | + persist-credentials: false |
| 86 | + fetch-depth: 0 |
| 87 | + |
| 88 | + - name: Production Deploy |
| 89 | + if: ${{ steps.release.outputs.release_created }} |
| 90 | + uses: aeternity/ae-github-actions/argocd-deploy@v4 |
| 91 | + with: |
| 92 | + url-prefix: ${{ steps.release.outputs.tag_name }} |
| 93 | + env: ${{ env.ENV }} |
| 94 | + app: ${{ env.APP }} |
| 95 | + |
| 96 | + - name: Push changes |
| 97 | + uses: ad-m/github-push-action@master |
| 98 | + with: |
| 99 | + repository: aeternity/gitops-apps |
| 100 | + github_token: ${{ secrets.BOT_GITHUB_TOKEN }} |
| 101 | + branch: prd |
0 commit comments