Skip to content

Commit c81da0f

Browse files
committed
Build Docker images
1 parent 2a3f646 commit c81da0f

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

.github/workflows/docker.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-docker:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout source
13+
uses: actions/checkout@v2
14+
15+
- name: Generate Dockerfile
16+
run: bash gen-docker-image.sh
17+
working-directory: utils
18+
19+
- name: Build Docker image
20+
run: docker build -t nipy/heudiconv:master .
21+
22+
- name: Push Docker image
23+
run: |
24+
docker login -u "$DOCKER_LOGIN" --password-stdin <<<"$DOCKER_TOKEN"
25+
docker push nipy/heudiconv:master
26+
env:
27+
DOCKER_LOGIN: ${{ secrets.DOCKER_LOGIN }}
28+
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
29+
30+
# vim:set sts=2:

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
auto-release:
1111
runs-on: ubuntu-latest
1212
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
13+
outputs:
14+
auto-version: ${{ steps.auto-version.outputs.version }}
1315
steps:
1416
- name: Checkout source
1517
uses: actions/checkout@v2
@@ -32,11 +34,55 @@ jobs:
3234
- name: Install Python dependencies
3335
run: python -m pip install build bump2version twine
3436

37+
- name: Check whether a release is due
38+
id: auto-version
39+
run: |
40+
version="$(~/auto version)"
41+
echo "::set-output name=version::$version"
42+
env:
43+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
3545
- name: Create release
3646
run: ~/auto shipit
3747
env:
3848
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3949
TWINE_USERNAME: __token__
4050
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
4151

52+
build-docker:
53+
runs-on: ubuntu-latest
54+
needs: auto-release
55+
if: needs.auto-release.outputs.auto-version != ''
56+
steps:
57+
- name: Get tag of latest release
58+
id: latest-release
59+
run: |
60+
latest_tag="$(curl -fsSL https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | jq -r .tag_name)"
61+
echo "::set-output name=tag::$latest_tag"
62+
63+
- name: Checkout source
64+
uses: actions/checkout@v2
65+
with:
66+
ref: ${{ steps.latest-release.outputs.tag }}
67+
68+
- name: Generate Dockerfile
69+
run: bash gen-docker-image.sh
70+
working-directory: utils
71+
72+
- name: Build Docker images
73+
run: |
74+
docker build \
75+
-t nipy/heudiconv:master \
76+
-t nipy/heudiconv:latest \
77+
-t nipy/heudiconv:${{ steps.latest-release.outputs.tag }} \
78+
.
79+
80+
- name: Push Docker images
81+
run: |
82+
docker login -u "$DOCKER_LOGIN" --password-stdin <<<"$DOCKER_TOKEN"
83+
docker push --all-tags nipy/heudiconv
84+
env:
85+
DOCKER_LOGIN: ${{ secrets.DOCKER_LOGIN }}
86+
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
87+
4288
# vim:set sts=2:

0 commit comments

Comments
 (0)