Skip to content

Release

Release #41

Workflow file for this run

# Copyright 2020-2024 Crown Copyright
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Release
on:
milestone:
types:
- closed
workflow_dispatch:
jobs:
create-release-tag:
runs-on: ubuntu-latest
if: github.event_name == 'milestone'
outputs:
branch_name: ${{ steps.branch.outputs.branch_name }}
steps:
- name: Checkout master
uses: actions/checkout@v4
with:
ref: master
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up Github credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Set release version
run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV
- name: Set branch name
run: echo "BRANCH_NAME=$(git branch -a | grep $RELEASE_VERSION | tail -n 1 | cut -c 18-)" >> $GITHUB_ENV
- name: Output branch name
id: branch
run: echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- name: Fail if no branch found
if: ${{ !env.BRANCH_NAME }}
run: exit 1
- name: Merge release into master
run: |
git checkout ${{ env.BRANCH_NAME }}
git checkout master
git merge ${{ env.BRANCH_NAME }}
- name: Push changes
run: |
git tag v${RELEASE_VERSION}
git push origin v${RELEASE_VERSION}
git push
update-branches:
runs-on: ubuntu-latest
if: github.event_name == 'milestone'
strategy:
matrix:
branch:
- develop
- gh-pages
needs:
- create-release-tag
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up Github credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Merge release into branch
run: |
git checkout ${{ needs.create-release-tag.outputs.branch_name }}
git checkout ${{ matrix.branch }}
git merge ${{ needs.create-release-tag.outputs.branch_name }} --strategy-option theirs
git push
publish-images-to-dockerhub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: develop
- name: Build images with Accumulo 2 dependency
run: ./cd/build_images.sh ./docker/accumulo2.env
- name: Build core images with Accumulo 1 dependency (Legacy)
run: ./cd/build_core_images.sh ./docker/accumulo1.env
- name: Publish images
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
GHCR_USERNAME: ${{ github.actor }}
GHCR_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: ./cd/publish_images.sh
create-release-notes:
runs-on: ubuntu-latest
if: github.event_name == 'milestone'
needs:
- create-release-tag
- update-branches
outputs:
release_upload_url: ${{ steps.upload_notes.outputs.upload_url }}
steps:
- uses: actions/checkout@v4
with:
ref: develop
- name: Create Release Notes
id: create_release_notes
uses: docker://decathlon/release-notes-generator-action:3.1.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set version
run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV
- name: Upload notes
id: upload_notes
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.RELEASE_VERSION }}
name: Gaffer Docker ${{ env.RELEASE_VERSION }}
body_path: release_file.md
upload-release-artifacts:
runs-on: ubuntu-latest
if: github.event_name == 'milestone'
needs:
- create-release-tag
- create-release-notes
strategy:
matrix:
chart:
- hdfs
- accumulo
- gaffer
- gaffer-road-traffic
- gaffer-jhub
steps:
- uses: actions/checkout@v4
with:
ref: develop
- name: Install dependencies
run: ./cd/install_dependencies.sh
- name: Create Asset
env:
chart: ${{ matrix.chart }}
run: |
helm package "kubernetes/${chart}"
filename=$(ls | grep ${chart}-[0-9]*.[0-9]*.[0-9]*.tgz)
echo "ASSET_FILENAME=${filename}" >> $GITHUB_ENV
- name: Upload chart artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.chart }}
path: ${{ env.ASSET_FILENAME }}
retention-days: 1
- name: Upload Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ github.event.milestone.title }} ${{ env.ASSET_FILENAME }}
update-helm-repo:
runs-on: ubuntu-latest
if: github.event_name == 'milestone'
needs:
- upload-release-artifacts
steps:
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
- name: Set up Github credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Download packaged charts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Update repo
run: |
mv artifacts/*/*.tgz .
helm repo index . --url "https://github.com/gchq/gaffer-docker/releases/download/${{ github.event.milestone.title }}" --merge index.yaml
sed -i'' -e 's|file://.*|https://gchq.github.io/gaffer-docker|g' index.yaml
rm *.tgz
rm -r artifacts
git commit -am "Updated index.yaml"
git push