-
-
Notifications
You must be signed in to change notification settings - Fork 131
115 lines (94 loc) · 3.16 KB
/
release.yml
File metadata and controls
115 lines (94 loc) · 3.16 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Release
on:
workflow_dispatch:
jobs:
matrix:
name: Find layers
runs-on: ubuntu-latest
if: ${{ github.actor != 'bref-bot' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
# Only find layers that have changed since last tag
- id: find-layers
run: |
git fetch --prune --unshallow
echo "::set-output name=list::$(git diff --name-only HEAD $(git describe --tags --abbrev=0) | grep layers/ | cut -d / -f 2 | sort | uniq | jq -R -s -c 'split("\n")[:-1]')"
outputs:
# Make the outputs accessible outside this job
list: ${{ steps.find-layers.outputs.list }}
build:
needs: matrix
name: Build & publish layer
runs-on: ubuntu-latest
if: ${{ github.actor != 'bref-bot' }}
env:
DOCKER_BUILDKIT: '1'
strategy:
fail-fast: false
matrix:
layer: ${{ fromJson(needs.matrix.outputs.list) }}
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download dependencies
run: composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable
- name: Clean export directory
run: make clean
- name: Build layers
run: layer=${{ matrix.layer }} make layers
- name: Publish layers
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }}
run: php ./bref-extra publish
release:
needs: build
name: Update layers and release
runs-on: ubuntu-latest
if: ${{ github.actor != 'bref-bot' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download dependencies
run: composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable
- name: List layers
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }}
run: php ./bref-extra list
- name: Get next version
id: version
run: |
LATEST=$(git describe --tags --abbrev=0)
MAJOR=$(echo $LATEST | cut -d. -f1)
MINOR=$(echo $LATEST | cut -d. -f2)
PATCH=$(echo $LATEST | cut -d. -f3)
echo "version=$MAJOR.$MINOR.$((PATCH + 1))" >> $GITHUB_OUTPUT
- name: Commit changes
run: |
git config --local user.email "github-bot@bref.sh"
git config --local user.name "Bref Bot"
git add layers.json
git commit -m "Update layer versions"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
branch: master
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}