forked from ckan/ckan-docker
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separate build and release pipelines.
- Loading branch information
1 parent
c90330c
commit 9a9a9b2
Showing
3 changed files
with
85 additions
and
78 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,34 @@ | ||
name: Build CKAN Docker | ||
|
||
name: Build Docker Image | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the master branch | ||
push: | ||
branches: | ||
# - | ||
- deploy | ||
pull_request: | ||
branches: | ||
# - master | ||
- deploy | ||
|
||
- master | ||
- dev | ||
# - build-pipeline | ||
jobs: | ||
build: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- 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 Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- 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 Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./ckan | ||
file: ./ckan/Dockerfile | ||
push: true | ||
tags: | | ||
benmotevalli/ckan-auscope:latest | ||
benmotevalli/ckan-auscope:${{ github.sha }} | ||
benmotevalli/ckan-auscope:${{ github.ref_name }} | ||
# Original Build | ||
# ============== | ||
# name: Build CKAN Docker | ||
|
||
# on: | ||
# # Trigger the workflow on push or pull request, | ||
# # but only for the master branch | ||
# push: | ||
# branches: | ||
# - master | ||
# pull_request: | ||
# branches: | ||
# - master | ||
|
||
# jobs: | ||
# build: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
|
||
# - name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v1 | ||
|
||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v1 | ||
|
||
# - name: NGINX build | ||
# uses: docker/build-push-action@v2 | ||
# with: | ||
# context: ./nginx | ||
# file: ./nginx/Dockerfile | ||
# push: false | ||
# tags: kowhai/ckan-docker-nginx:test-build-only | ||
|
||
# - name: PostgreSQL build | ||
# uses: docker/build-push-action@v2 | ||
# with: | ||
# context: ./postgresql | ||
# file: ./postgresql/Dockerfile | ||
# push: false | ||
# tags: kowhai/ckan-docker-postgresql:test-build-only | ||
|
||
# - name: CKAN build | ||
# uses: docker/build-push-action@v2 | ||
# with: | ||
# context: ./ckan | ||
# file: ./ckan/Dockerfile | ||
# push: false | ||
# tags: kowhai/ckan-docker-ckan:test-build-only | ||
benmotevalli/ckan-auscope:${{ github.ref == 'refs/heads/master' && 'latest' || 'dev' }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
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' | ||
# if: 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: Bump version | ||
id: bump_version | ||
run: | | ||
bump2version ${{ github.event.inputs.releaseType }} --list | ||
echo "New version: $(grep 'current_version = ' setup.cfg | sed -r 's/current_version = //')" | ||
echo "::set-output name=version::$(grep 'current_version = ' setup.cfg | sed -r 's/current_version = //')" | ||
- name: Push the tags and changes | ||
run: | | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "GitHub Actions" | ||
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 }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[bumpversion] | ||
current_version = 0.1.0 | ||
commit = True | ||
tag = True |