forked from ckan/ckan-docker
-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (53 loc) · 1.78 KB
/
release.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
name: Versioned Release Image
on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release Type (patch/minor/major)'
required: true
default: 'patch'
branches:
- master
- build-pipeline
jobs:
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/build-pipeline'
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install bump2version
run: pip install bump2version
- name: Set up Git identity
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
- name: Bump version
id: bump_version
run: |
bump2version ${{ github.event.inputs.releaseType }} --config-file ./ckan/setup.cfg
NEW_VERSION=$(grep 'current_version = ' ./ckan/setup.cfg | sed -r 's/current_version = //')
echo "New version: $NEW_VERSION"
echo "::set-output name=version::$NEW_VERSION"
# working-directory: ./ckan
- name: Push the tags and changes
run: |
git push origin --tags
git push
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and Push Versioned Docker image
uses: docker/build-push-action@v2
with:
context: ./ckan
file: ./ckan/Dockerfile
push: true
tags: benmotevalli/ckan-auscope:${{ steps.bump_version.outputs.version }}