-
Notifications
You must be signed in to change notification settings - Fork 99
78 lines (66 loc) · 2.93 KB
/
Copy pathrelease.yml
File metadata and controls
78 lines (66 loc) · 2.93 KB
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
---
name: Auto-release on PR merge
on:
# ATM, this is the closest trigger to a PR merging
push:
branches:
- master
env:
AUTO_VERSION: v11.3.0
jobs:
auto-release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
steps:
- uses: actions/checkout@v6
- name: Prepare repository
# Fetch full git history and tags
run: git fetch --unshallow --tags
- name: Unset header
# checkout@v2 adds a header that makes branch protection report errors
# because the Github action bot is not a collaborator on the repo
run: |
if git config --local --get-all http.https://github.com/.extraheader > /dev/null; then
git config --local --unset-all http.https://github.com/.extraheader
fi
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Download auto
run: |
auto_download_url="$(curl -fsSL https://api.github.com/repos/intuit/auto/releases/tags/$AUTO_VERSION | jq -r '.assets[] | select(.name == "auto-linux.gz") | .browser_download_url')"
wget -O- "$auto_download_url" | gunzip > ~/auto
chmod a+x ~/auto
- name: Query 'auto' on type of the release
id: auto-version
run: |
set -o pipefail
~/auto version -vv | tee /tmp/auto-version
version="$(sed -ne '/Calculated SEMVER bump:/s,.*: *,,p' /tmp/auto-version)"
echo "version=$version" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ secrets.AUTO_USER_TOKEN }}
- name: Create release
if: steps.auto-version.outputs.version != ''
run: |
~/auto shipit -vv
env:
GH_TOKEN: ${{ secrets.AUTO_USER_TOKEN }}
- name: Login to Docker Hub
run: |
docker login -u "$DOCKER_LOGIN" --password-stdin <<<"$DOCKER_TOKEN"
env:
DOCKER_LOGIN: ${{ secrets.DOCKER_LOGIN }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push master Docker image
run: |
docker build -t repronim/neurodocker:master .
docker push repronim/neurodocker:master
- name: Build and push release Docker images
if: steps.auto-version.outputs.version != ''
run: |
docker tag repronim/neurodocker:master repronim/neurodocker:latest
docker tag repronim/neurodocker:master repronim/neurodocker:"$(git describe | sed -e 's,^v,,g')"
docker push repronim/neurodocker:latest
docker push repronim/neurodocker:"$(git describe | sed -e 's,^v,,g')"