Merge pull request #113 from kjsanger/feature/irods-4.3.2 #23
Workflow file for this run
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
name: "Create release" | |
on: | |
push: | |
tags: | |
- "*" | |
env: | |
BUNDLE_NAME: bundle-ub-16.04-irods-clients-4.2.7.tgz | |
jobs: | |
release_variables: | |
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 | |
outputs: | |
isRelease: ${{ github.sha == env.MASTER_SHA }} | |
preRelease: ${{ !(github.sha == env.MASTER_SHA) }} | |
releaseVersion: ${{ env.RELEASE_VERSION }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: release_variables | |
# Workaround for https://github.com/actions/runner/issues/1483 | |
# Actions coerces boolean to string | |
if: needs.release_variables.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 }} | |
bundle: | |
runs-on: ubuntu-latest | |
container: "ghcr.io/wtsi-npg/ub-16.04-irods-clients-4.2.7:latest" | |
needs: deploy | |
if: always() | |
steps: | |
- name: "Install exodus" | |
run: | | |
apt-get update | |
apt-get install -q -y python3-pip | |
pip3 install exodus-bundler | |
- name: "Bundle clients" | |
run: exodus --tarball --add /usr/lib/irods/plugins/ --add /lib/x86_64-linux-gnu/ --output $BUNDLE_NAME /usr/local/bin/baton-* /usr/bin/ils /usr/bin/iinit /usr/bin/imeta | |
- name: "Upload bundle" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: client_bundle | |
path: ${{ env.BUNDLE_NAME }} | |
release: | |
runs-on: ubuntu-latest | |
needs: [release_variables, bundle] | |
if: always() | |
defaults: | |
run: | |
shell: bash -l -e -o pipefail {0} | |
steps: | |
- name: "Download artifact" | |
uses: actions/download-artifact@v3 | |
with: | |
name: client_bundle | |
- name: "Create Release" | |
uses: ncipollo/[email protected] | |
with: | |
name: ${{ env.NAME }} | |
prerelease: ${{ env.PRERELEASE }} | |
artifacts: ${{ env.BUNDLE_NAME }} | |
removeArtifacts: true | |
artifactErrorsFailBuild: true | |
generateReleaseNotes: true | |
env: | |
NAME: ${{ needs.release_variables.outputs.releaseVersion }} | |
PRERELEASE: ${{ needs.release_variables.outputs.preRelease }} |