-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (84 loc) · 3.07 KB
/
release.yml
File metadata and controls
98 lines (84 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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 }}
${{ steps.login-ecr.outputs.registry }}/${{ env.IMAGE_NAME }}:latest
${{ steps.login-ecr.outputs.registry }}/${{ env.IMAGE_NAME }}:${{ needs.release-module.outputs.new_version }}