Skip to content

Hotfix for the release CI #43

Hotfix for the release CI

Hotfix for the release CI #43

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: Full Release
on:
pull_request:
branches:
- master
types: [closed]
jobs:
get-release-version:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged }}
outputs:
release_version: ${{ steps.release-version.outputs.release_version }}
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: Get latest tag
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- name: Format latest tag
run: echo "CURRENT_VERSION=$(echo ${{ steps.get-latest-tag.outputs.tag }} | sed 's/^v//')" >> $GITHUB_ENV
- name: Set release version
id: release-version
run: echo "release_version=$(echo $CURRENT_VERSION)" >> $GITHUB_OUTPUT
update-branches:
runs-on: ubuntu-latest
strategy:
matrix:
branch:
- develop
- gh-pages
needs:
- get-release-version
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 master into branches
run: |
git merge origin/master
git push
publish-images-to-dockerhub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: master
- 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
update-github-releases:
runs-on: ubuntu-latest
needs:
- get-release-version
steps:
- uses: actions/checkout@v4
with:
ref: master
- name: Set version
run: echo "RELEASE_VERSION=$(echo ${{ needs.get-release-version.outputs.release_version }})" >> $GITHUB_ENV
- name: Create github release
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 }}
upload-release-artifacts:
runs-on: ubuntu-latest
needs:
- get-release-version
strategy:
matrix:
chart:
- hdfs
- accumulo
- gaffer
- gaffer-road-traffic
- gaffer-jhub
steps:
- uses: actions/checkout@v4
with:
ref: master
- 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 ${{ needs.release-version.outputs.release_version }} ${{ env.ASSET_FILENAME }}
update-helm-repo:
runs-on: ubuntu-latest
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/${{ steps.release-version.outputs.release_version }}" --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