chore(master): release 1.0.0 (#615) #319
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: Release | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
env: | |
GISAID_API_TOKEN: ${{ secrets.GISAID_API_TOKEN }} | |
steps: | |
- uses: google-github-actions/release-please-action@v4 | |
id: release | |
with: | |
release-type: simple | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install jq | |
run: sudo apt-get install -y jq | |
- name: Check if PR is created | |
id: pr_created | |
run: | | |
export PRNUMBER=$( echo '${{ steps.release.outputs.pr }}' | jq -r '.number' ) | |
if [ "$PRNUMBER" -eq "$PRNUMBER" ] 2>/dev/null; then | |
echo "::set-output name=pr::$(echo true)" | |
echo "::set-output name=number::$(echo $PRNUMBER)" | |
else | |
[ -n "$PRNUMBER" ] && echo "::set-output name=pr::$(echo false)" && exit 0 | |
echo "::set-output name=pr::$(echo false)" | |
fi | |
- name: PR exists debug print | |
run: | | |
echo ${{ steps.pr_created.outputs.pr }} | |
- name: Release debug print | |
run: | | |
echo ${{ steps.release.outputs.release_created }} | |
- name: PR If debug print | |
run: | | |
echo ${{ steps.pr_created.outputs.pr == 'true' }} | |
- name: Release If debug print | |
run: | | |
echo ${{ steps.release.outputs.release_created == 'true' }} | |
- name: Both debug print | |
run: | | |
echo ${{ steps.pr_created.outputs.pr == 'true' && steps.release.outputs.release_created != 'true' }} | |
- name: Space | |
run: | | |
echo "Free space:" | |
df -h | |
- name: Maximize build space for container image | |
if: ${{ steps.release.outputs.release_created == 'true' }} | |
uses: easimon/maximize-build-space@master | |
with: | |
root-reserve-mb: 512 | |
swap-size-mb: 1024 | |
remove-dotnet: "true" | |
remove-haskell: "true" | |
remove-android: "true" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Space | |
run: | | |
echo "Free space:" | |
df -h | |
- uses: actions/checkout@v4 | |
- name: Checkout release PR locally | |
if: ${{ steps.pr_created.outputs.pr == 'true' && steps.release.outputs.release_created != 'true' }} | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email github-actions[bot]@users.noreply.github.com | |
git fetch origin | |
git pull origin pull/${{ steps.pr_created.outputs.number }}/head | |
- name: Export version as environment variable | |
if: ${{ steps.pr_created.outputs.pr == 'true' || steps.release.outputs.release_created != 'true' }} | |
run: | | |
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV | |
echo "Version: ${{ env.VERSION }}" | |
echo ${{ steps.release.outputs.tag_name }} | |
- name: Switch to release PR on origin | |
if: ${{ steps.pr_created.outputs.pr == 'true' && steps.release.outputs.release_created != 'true' }} | |
run: | | |
git checkout release-please--branches--master | |
- name: Change containerized tag | |
if: ${{ steps.pr_created.outputs.pr == 'true' && steps.release.outputs.release_created != 'true' }} | |
run: | | |
sed -i "/containerized/c\containerized: \"quay.io/uncovar/uncovar#${{ env.VERSION }}\"" workflow/Snakefile | |
- name: Push changed containerized tag | |
if: ${{ steps.pr_created.outputs.pr == 'true' && steps.release.outputs.release_created != 'true' }} | |
run: | | |
git add workflow/Snakefile | |
git commit -m "Changed containerized tag to ${{ env.VERSION }}" | |
git push | |
- name: Create Dockerfile | |
if: ${{ steps.release.outputs.release_created == 'true' }} | |
uses: snakemake/[email protected] | |
with: | |
directory: . | |
snakefile: workflow/Snakefile | |
task: "containerize" | |
- name: Debug print | |
run: | | |
pwd | |
ls -alh | |
- name: Set up QEMU | |
if: ${{ steps.release.outputs.release_created == 'true' }} | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
if: ${{ steps.release.outputs.release_created == 'true' }} | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Quay Registry | |
if: ${{ steps.release.outputs.release_created == 'true' }} | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: uncovar+robot | |
password: ${{ secrets.QUAYIO_PASSWORD }} | |
- name: Build and push | |
if: ${{ steps.release.outputs.release_created == 'true' }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: | | |
quay.io/uncovar/uncovar:latest | |
quay.io/uncovar/uncovar:${{ env.VERSION }} | |
quay.io/uncovar/uncovar:${{ github.sha }} |