-
Notifications
You must be signed in to change notification settings - Fork 2
162 lines (145 loc) · 6.38 KB
/
create-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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Create cflinuxfs4-compat stack release
on:
repository_dispatch:
types: [release-dispatch]
workflow_dispatch:
inputs:
version:
description: 'Version of the cflinuxfs4 stack release a compat stack of (e.g. 1.2.3)'
required: true
jobs:
create:
name: Create Compat Stack
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.repo-dispatch.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Receive Repository Dispatch
id: repo-dispatch
run: |
version="${{ github.event.client_payload.version }}"
if [ -z "${version}" ]; then
version="${{ github.event.inputs.version }}"
fi
echo "version=${version}" >> "$GITHUB_OUTPUT"
- name: Wait for rootfs docker image
run: |
until eval "$(
skopeo list-tags docker://cloudfoundry/cflinuxfs4 \
| jq -r \
--arg VERSION "${{ steps.repo-dispatch.outputs.version }}" \
'.Tags| any(. == $VERSION)')" ; do
echo "Waiting 30s for docker://cloudfoundry/cflinuxfs4:${{ steps.repo-dispatch.outputs.version }} to be available"
sleep 30
done
echo "image docker://cloudfoundry/cflinuxfs4:${{ steps.repo-dispatch.outputs.version }} is available"
- name: Checkout cflinuxfs4
uses: actions/checkout@v3
with:
repository: cloudfoundry/cflinuxfs4
path: cflinuxfs4
- name: Create stack
id: create-stack
env:
DOCKERHUB_USERNAME: ${{ secrets.CF_DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.CF_DOCKERHUB_PASSWORD }}
run: |
pushd cflinuxfs4
echo "${DOCKERHUB_PASSWORD}" | sudo skopeo login --username "${DOCKERHUB_USERNAME}" --password-stdin index.docker.io
echo "Making compat stack"
make compat version=${{ steps.repo-dispatch.outputs.version }}
popd
- name: BOSH blob add and upload
id: bosh-blobs
uses: cloudfoundry/buildpacks-github-config/actions/stack/add-upload-blobs@main
with:
version: ${{ steps.repo-dispatch.outputs.version }}
access-key-id: ${{ secrets.CF_S3_ACCESS_KEY }}
secret-access-key: ${{ secrets.CF_S3_SECRET_ACCESS_KEY }}
release-name: cflinuxfs4-compat
blob-glob: cflinuxfs4/cflinuxfs4-*.tar.gz
blob-name: rootfs
- name: Clean up cflinuxfs4 repository
# clear up cflinuxfs4 directory before we run bosh create-release so working directory is clean
run: rm -rf cflinuxfs4
- name: Git commit blobs.yml
id: commit-1
uses: paketo-buildpacks/github-config/actions/pull-request/create-commit@main
with:
message: "Updating blobs for cflinuxfs4-compat bosh release version ${{ steps.repo-dispatch.outputs.version }}"
pathspec: "config/blobs.yml"
committer_name: cf-buildpacks-eng
committer_email: ${{ secrets.CF_BOT_EMAIL }}
keyid: ${{ secrets.CF_BOT_GPG_SIGNING_KEY_ID }}
key: ${{ secrets.CF_BOT_GPG_SIGNING_KEY }}
- name: BOSH release creation
id: bosh-release
uses: cloudfoundry/buildpacks-github-config/actions/stack/create-release@main
with:
version: ${{ steps.repo-dispatch.outputs.version }}
release-name: cflinuxfs4-compat
- name: Git add release files
# manually git add files since there is a bug with multiple-file pathspec in the create-commit action
id: git-add
run: |
git add .final_builds releases/**/*-${{ steps.repo-dispatch.outputs.version }}.yml releases/**/index.yml
git status
- name: Git commit
id: commit-2
uses: paketo-buildpacks/github-config/actions/pull-request/create-commit@pathspec-fix
with:
message: "Final cflinuxfs4-compat bosh release version ${{ steps.repo-dispatch.outputs.version }}, containing cflinuxfs-compat version ${{ steps.repo-dispatch.outputs.version }}"
pathspec: .final_builds releases/**/*-${{ steps.repo-dispatch.outputs.version }}.yml releases/**/index.yml
committer_name: cf-buildpacks-eng
committer_email: ${{ secrets.CF_BOT_EMAIL }}
keyid: ${{ secrets.CF_BOT_GPG_SIGNING_KEY_ID }}
key: ${{ secrets.CF_BOT_GPG_SIGNING_KEY }}
- name: Git push
if: ${{ steps.commit-1.outputs.commit_sha != '' || steps.commit-2.outputs.commit_sha != '' }}
uses: paketo-buildpacks/github-config/actions/pull-request/push-branch@main
with:
branch: "main"
- name: Setup Release Assets
id: assets
run: |
assets="$(jq --null-input --compact-output \
'[
{
"path": "releases/cflinuxfs4-compat/cflinuxfs4-compat-${{ steps.repo-dispatch.outputs.version }}.tgz",
"name": "cflinuxfs4-compat-${{ steps.repo-dispatch.outputs.version }}.tgz",
"content_type": "application/gzip"
}]')"
printf "assets=%s\n" "${assets}" >> "$GITHUB_OUTPUT"
- name: Create Release
uses: paketo-buildpacks/github-config/actions/release/create@main
with:
repo: ${{ github.repository }}
token: ${{ secrets.CF_BOT_GH_TOKEN }}
tag_name: ${{ steps.repo-dispatch.outputs.version }}
target_commitish: ${{ github.sha }}
name: ${{ steps.repo-dispatch.outputs.version }}
body: "This release ships cflinuxfs4-compat-release version ${{ steps.repo-dispatch.outputs.version }}, based on [cflinuxfs4](https://github.com/cloudfoundry/cflinuxfs4/releases/tag/${{ steps.repo-dispatch.outputs.version }}) with the addition of python, ruby, and related packages."
draft: false
assets: ${{ steps.assets.outputs.assets }}
failure:
name: Alert on Failure
runs-on: ubuntu-22.04
needs: [create]
if: ${{ always() && needs.create.result == 'failure' }}
steps:
- name: File Failure Alert Issue
uses: paketo-buildpacks/github-config/actions/issue/file@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
repo: ${{ github.repository }}
label: "failure:release"
comment_if_exists: true
issue_title: "Failure: cflinuxfs4-compat-release workflow"
issue_body: |
Release creation workflow [failed](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}).
comment_body: |
Another failure occurred: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}