-
Notifications
You must be signed in to change notification settings - Fork 27
112 lines (96 loc) · 4.09 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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Release
on:
# This workflow can be manually triggered
workflow_dispatch:
# But the main use case is to release new layers when a release is created
release:
types: [ published ]
# Necessary to deploy to AWS using OIDC
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
release:
name: Publish ${{ matrix.cpu }} layers
runs-on: ubuntu-22.04
strategy:
matrix:
cpu:
- x86
- arm
steps:
- uses: actions/checkout@v4
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
# See https://stackoverflow.com/questions/70312490/github-actions-runner-environment-doesnt-build-for-arm-images
- name: Set up QEMU to run ARM images (that were built with Depot)
uses: docker/setup-qemu-action@v3
- uses: depot/setup-action@v1
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::534081306603:role/bref-layer-publisher-github-actions
role-session-name: bref-layer-publisher-github-actions
aws-region: us-east-1
- name: Configure Docker Hub credentials
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- run: make docker-images
env:
CPU: ${{ matrix.cpu }}
USE_DEPOT: 1
DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }}
- run: make layers
env:
CPU: ${{ matrix.cpu }}
- run: make test
env:
CPU: ${{ matrix.cpu }}
- run: make upload-layers
env:
CPU: ${{ matrix.cpu }}
- run: make upload-to-docker-hub
env:
CPU: ${{ matrix.cpu }}
DOCKER_TAG: ${{ steps.get_version.outputs.VERSION }}
update-layer-versions:
name: Update layer versions in brefphp/bref
runs-on: ubuntu-22.04
needs: [ release ]
steps:
- name: Trigger layer update in brefphp/bref
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN_TRIGGER }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'brefphp',
repo: 'bref',
workflow_id: 'update-layer-versions.yml',
ref: 'master',
inputs: {
release_url: '${{ github.event.release.url }}',
release_html_url: '${{ github.event.release.html_url }}',
release_name: '${{ github.event.release.name }}'
}
})
update-layer-js-versions:
name: Update layer versions in brefphp/layers.js
runs-on: ubuntu-22.04
needs: [ release ]
steps:
- name: Trigger release in brefphp/layers.js
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN_TRIGGER }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'brefphp',
repo: 'layers.js',
workflow_id: 'release.yml',
ref: 'main'
})