-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (61 loc) · 2.15 KB
/
release.yml
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
name: Release
on: workflow_dispatch
env:
AWS_REGION: us-east-2
DOCKER_BUILDKIT: 1
DOCKER_CACHE_PATH: ${{ github.workspace }}/tmp/docker-cache
permissions:
id-token: write
contents: read
actions: read
jobs:
release:
name: Release
runs-on: ubuntu-20.04
needs: []
steps:
- name: Checkout
# A GitHub Action to checkout a repository.
# https://github.com/actions/checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false
- name: Inject slug/short variables
# A GitHub Action to expose the slug values of some GitHub ENV variables
# https://github.com/rlespinasse/github-slug-action
uses: rlespinasse/[email protected]
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.DEPLOYER_PRODUCTION_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Create release
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: scribd/semantic-release
run: |
docker pull $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker run --rm \
-v ${{ github.workspace }}:/src \
-w /src \
-e CI=true \
-e GITHUB_ACTIONS=true \
-e GITHUB_TOKEN=${{ secrets.SCRIBD_GITHUB_RELEASE_TOKEN }} \
-e GITHUB_REPOSITORY=${{ github.repository }} \
-e GITHUB_WORKSPACE=${{ github.workspace }} \
-e GITHUB_SHA=${{ github.sha }} \
-e GITHUB_REF=${{ github.ref }} \
$ECR_REGISTRY/$ECR_REPOSITORY:latest --publish
- name: Logout of Amazon ECR
if: always()
run: docker logout ${{ steps.login-ecr.outputs.registry }}
- name: Send Slack notification
if: always()
uses: scribd/[email protected]
with:
token: ${{ secrets.SCRIBD_SLACK_GENERIC_TOKEN_PUBLIC }}
channel: service-foundations-release