Merge pull request #44 from energywebfoundation/feat/auth #26
This file contains hidden or 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 EWX Worker Node | |
| on: | |
| push: | |
| branches: ['master'] | |
| # env: | |
| # IMAGE_NAME: ${{ secrets.EWX_WORKER_NODE_SERVER }} | |
| # AWS_REGION: us-east-1 | |
| jobs: | |
| cancel-previous: | |
| name: Cancel Previous Runs | |
| runs-on: ${{ vars.RUNNER_LABEL || 'ubuntu-latest' }} | |
| timeout-minutes: 3 | |
| steps: | |
| - uses: styfle/cancel-workflow-action@0.9.0 | |
| with: | |
| access_token: ${{ github.token }} | |
| release-module: | |
| name: Release ewx-worker-node-server | |
| runs-on: ${{ vars.RUNNER_LABEL || 'ubuntu-latest' }} | |
| needs: [cancel-previous] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Bump version and push tag | |
| id: tag_version | |
| uses: mathieudutour/github-tag-action@v6.2 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| release_branches: master | |
| custom_release_rules: major:major:Major Changes,minor:minor:Minor Changes,chore:patch:Chores | |
| - name: Create a GitHub release | |
| uses: ncipollo/release-action@v1 | |
| if: github.ref == 'refs/heads/master' | |
| with: | |
| tag: v${{ steps.tag_version.outputs.new_version }} | |
| name: Release ${{ steps.tag_version.outputs.new_version }} | |
| body: ${{ steps.tag_version.outputs.changelog }} | |
| outputs: | |
| new_version: ${{ steps.tag_version.outputs.new_version }} | |
| docker-build-and-push: | |
| name: Build and Push Docker Image | |
| runs-on: ${{ vars.RUNNER_LABEL || 'ubuntu-latest' }} | |
| timeout-minutes: 20 | |
| needs: [release-module] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # - name: Configure AWS credentials | |
| # uses: aws-actions/configure-aws-credentials@v2 | |
| # with: | |
| # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| # aws-region: us-east-1 | |
| # mask-aws-account-id: true | |
| # - name: Log in to ECR | |
| # id: login-ecr | |
| # uses: aws-actions/amazon-ecr-login@v2 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Build and push | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| build-args: | | |
| GIT_SHA=${{ github.sha }} | |
| VERSION=${{ needs.release-module.outputs.new_version }} | |
| tags: | | |
| ghcr.io/${{ github.repository }}/ewx-worker-node-server:latest | |
| ghcr.io/${{ github.repository }}/ewx-worker-node-server:${{ needs.release-module.outputs.new_version }} | |