Skip to content

Merge pull request #35 from wtsi-npg/devel #17

Merge pull request #35 from wtsi-npg/devel

Merge pull request #35 from wtsi-npg/devel #17

Workflow file for this run

name: "Create release"
on:
push:
tags:
- "*"
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l -e -o pipefail {0}
steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Fetch Tags"
# Workaround for https://github.com/actions/checkout/issues/290
run: |
# Avoid git exiting when Actions runs
git config --global --add safe.directory "$PWD"
git fetch --tags --force
- name: "Get release variables"
run: |
echo 'RELEASE_VERSION='$(git describe --always --tags) >> $GITHUB_ENV
echo 'MASTER_SHA='$(git rev-parse origin/master) >> $GITHUB_ENV
- name: "Create Release"
uses: ncipollo/[email protected]
with:
name: ${{ env.RELEASE_VERSION }}
prerelease: ${{ !(github.sha == env.MASTER_SHA) }}
generateReleaseNotes: true
outputs:
isRelease: ${{ github.sha == env.MASTER_SHA }}
deploy:
runs-on: ubuntu-latest
needs: release
# Workaround for https://github.com/actions/runner/issues/1483
# Actions coerces boolean to string
if: needs.release.outputs.isRelease == 'true'
steps:
- name: "Free disk space on the runner"
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: false
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Fetch Tags"
# Workaround for https://github.com/actions/checkout/issues/290
run: |
# Avoid git exiting when Actions runs
git config --global --add safe.directory "$PWD"
git fetch --tags --force
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
- name: "Login to ghcr.io"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Build and push Docker images"
run: |
cd docker
# Use the default builder because buildx cannot currently build on a base image
# that it has just built. See https://github.com/docker/buildx/issues/1453
# We still need buildx for its --build-context feature.
docker buildx use default
make GITHUB_ACTIONS=${GITHUB_ACTIONS} GITHUB_REPOSITORY_OWNER=${{ github.repository_owner }}
docker image prune --force
docker images
make push GITHUB_ACTIONS=${GITHUB_ACTIONS} GITHUB_REPOSITORY_OWNER=${{ github.repository_owner }}