-
Notifications
You must be signed in to change notification settings - Fork 8
150 lines (125 loc) · 4.81 KB
/
release-please.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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 }}