-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1442 from alphagov/fix-create_pr-add-build-image-…
…tags Fix create pr add build image tags
- Loading branch information
Showing
4 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Build and push images | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
build_and_push: | ||
name: ${{ matrix.app.name }} (${{ matrix.arch }}) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
app: | ||
- name: ckan | ||
version: 2.9.9 | ||
- name: pycsw | ||
version: 2.6.1 | ||
- name: postgis | ||
version: 13-3.1 | ||
- name: solr | ||
version: 8 | ||
arch: [ amd64 ] | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Login to GHCR | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.gitRef }} | ||
- name: Build and push images | ||
env: | ||
APP: ${{ matrix.app.name }} | ||
VERSION: ${{ matrix.app.version }} | ||
ARCH: ${{ matrix.arch }} | ||
GH_REF: ${{ github.ref_name }} | ||
run: ./docker/build-image.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,18 +9,19 @@ else | |
export IMAGE_TAG=$(gh api repos/alphagov/ckanext-datagovuk/branches/${GH_REF} | jq .commit.sha -r) | ||
export SOURCE_BRANCH=${GH_REF} | ||
fi | ||
BRANCH="ci/${IMAGE_TAG}" | ||
|
||
git config --global user.email "[email protected]" | ||
git config --global user.name "govuk-ci" | ||
|
||
git clone https://${GH_TOKEN}@github.com/alphagov/govuk-ckan-charts.git charts | ||
|
||
cd charts/charts/ckan/images | ||
git checkout -b ${BRANCH} | ||
|
||
for ENV in $(echo $ENVS | tr "," " "); do | ||
( | ||
BRANCH="ci/${IMAGE_TAG}-${ENV}" | ||
git checkout -b ${BRANCH} | ||
|
||
cd "${ENV}" | ||
for APP in ckan pycsw solr; do | ||
yq -i '.tag = env(IMAGE_TAG)' "${APP}.yaml" | ||
|
@@ -29,6 +30,6 @@ for ENV in $(echo $ENVS | tr "," " "); do | |
done | ||
git commit -m "Update image tags for ${ENV} to ${IMAGE_TAG}" | ||
git push --set-upstream origin "${BRANCH}" | ||
gh pr create --title "Update image tags for ${ENV} (${IMAGE_TAG})" --base main --head "${BRANCH}-${ENV}" --fill | ||
gh pr create --title "Update image tags for ${ENV} (${IMAGE_TAG})" --base main --head "${BRANCH}" --fill | ||
) | ||
done |