Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
leojonathanoh committed Apr 17, 2021
2 parents 025827c + 4e6c39a commit 2749222
Show file tree
Hide file tree
Showing 58 changed files with 1,260 additions and 118 deletions.
51 changes: 51 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name-template: 'v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🖊️ Refactors'
labels:
- 'refactor'
- title: '👗 Style'
labels:
- 'style'
- title: '📝 Documentation'
labels:
- 'docs'
- 'documentation'
- title: '🧰 Maintenance'
label: 'chore'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
version-resolver:
major:
labels:
# - 'major'
- 'breaking'
minor:
labels:
# - 'minor'
- 'feature'
- 'enhancement'
- 'refactor'
patch:
labels:
# - 'patch'
- 'fix'
- 'bugfix'
- 'bug'
- 'style'
- 'docs'
- 'documentation'
default: patch
sort-by: title
template: |
## Changes
$CHANGES
157 changes: 156 additions & 1 deletion .github/workflows/ci-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,108 @@ on:
- master

jobs:
build-v2-5-1-alpine-3-13:
runs-on: ubuntu-18.04
env:
VARIANT_TAG: v2.5.1-alpine-3.13
# VARIANT_TAG_WITH_REF: v2.5.1-alpine-3.13-${GITHUB_REF}
VARIANT_BUILD_DIR: variants/v2.5.1-alpine-3.13
steps:
- uses: actions/checkout@v1
- name: Display system info (linux)
run: |
set -e
hostname
whoami
cat /etc/*release
lscpu
free
df -h
pwd
docker info
docker version
- name: Login to docker registry
run: echo "${DOCKERHUB_REGISTRY_PASSWORD}" | docker login -u "${DOCKERHUB_REGISTRY_USER}" --password-stdin
env:
DOCKERHUB_REGISTRY_USER: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
DOCKERHUB_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}
- name: Build and push image
env:
DOCKERHUB_REGISTRY_USER: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
run: |
set -e
# Get 'project-name' from 'namespace/project-name'
CI_PROJECT_NAME=$( echo "${GITHUB_REPOSITORY}" | rev | cut -d '/' -f 1 | rev )
# Get 'ref-name' from 'refs/heads/ref-name'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )
SHA_SHORT=$( echo "${GITHUB_SHA}" | cut -c1-7 )
# Generate the final tags. E.g. 'master-v1.0.0-alpine' and 'master-b29758a-v1.0.0-alpine'
VARIANT_TAG_WITH_REF="${REF}-${VARIANT_TAG}"
VARIANT_TAG_WITH_REF_AND_SHA_SHORT="${REF}-${SHA_SHORT}-${VARIANT_TAG}"
docker build \
-t "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF}" \
-t "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF_AND_SHA_SHORT}" \
"${VARIANT_BUILD_DIR}"
docker push "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF}"
docker push "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF_AND_SHA_SHORT}"
- name: Clean-up
run: docker logout
if: always()
build-v2-4-10-alpine-3-12:
runs-on: ubuntu-18.04
env:
VARIANT_TAG: v2.4.10-alpine-3.12
# VARIANT_TAG_WITH_REF: v2.4.10-alpine-3.12-${GITHUB_REF}
VARIANT_BUILD_DIR: variants/v2.4.10-alpine-3.12
steps:
- uses: actions/checkout@v1
- name: Display system info (linux)
run: |
set -e
hostname
whoami
cat /etc/*release
lscpu
free
df -h
pwd
docker info
docker version
- name: Login to docker registry
run: echo "${DOCKERHUB_REGISTRY_PASSWORD}" | docker login -u "${DOCKERHUB_REGISTRY_USER}" --password-stdin
env:
DOCKERHUB_REGISTRY_USER: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
DOCKERHUB_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}
- name: Build and push image
env:
DOCKERHUB_REGISTRY_USER: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
run: |
set -e
# Get 'project-name' from 'namespace/project-name'
CI_PROJECT_NAME=$( echo "${GITHUB_REPOSITORY}" | rev | cut -d '/' -f 1 | rev )
# Get 'ref-name' from 'refs/heads/ref-name'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )
SHA_SHORT=$( echo "${GITHUB_SHA}" | cut -c1-7 )
# Generate the final tags. E.g. 'master-v1.0.0-alpine' and 'master-b29758a-v1.0.0-alpine'
VARIANT_TAG_WITH_REF="${REF}-${VARIANT_TAG}"
VARIANT_TAG_WITH_REF_AND_SHA_SHORT="${REF}-${SHA_SHORT}-${VARIANT_TAG}"
docker build \
-t "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF}" \
-t "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF_AND_SHA_SHORT}" \
"${VARIANT_BUILD_DIR}"
docker push "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF}"
docker push "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF_AND_SHA_SHORT}"
- name: Clean-up
run: docker logout
if: always()
build-v2-4-8-alpine-3-11:
runs-on: ubuntu-18.04
env:
Expand Down Expand Up @@ -467,4 +569,57 @@ jobs:
docker push "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF_AND_SHA_SHORT}"
- name: Clean-up
run: docker logout
if: always()
if: always()
resolve-release-tag:
runs-on: ubuntu-latest
outputs:
TAG: ${{ steps.resolve-release-tag.outputs.TAG }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Resolve release tag
id: resolve-release-tag
run: |
set +e
# E.g. 20210402
TODAYS_DATE=$( date -u '+%Y%m%d' )
# Is this the first tag for this date?
TODAYS_DATE_TAGS=$( git tag --list | grep "^$TODAYS_DATE" )
TAG=
if [ -z "$TODAYS_DATE_TAGS" ]; then
# E.g. 20210402.0.0
TAG="$TODAYS_DATE.0.0" # Send this to stdout
else
# E.g. if there are 20210402.0.0, 20210402.0.1, 20210402.0.2, this returns 2
VERSION_MINOR_LATEST=$( echo "$TODAYS_DATE_TAGS" | cut -d '.' -f 3 | sort -nr | head -n1 )
# Minor version
VERSION_MINOR=$( expr "$VERSION_MINOR_LATEST" + 1 )
# E.g. 20210402.0.3
TAG="$TODAYS_DATE.0.$VERSION_MINOR" # Send this to stdout
fi
echo "TODAYS_DATE: $TODAYS_DATE"
echo "TODAYS_DATE_TAGS: $TODAYS_DATE_TAGS"
echo "TAG: $TAG"
echo "::set-output name=TAG::$TAG"
- name: Print outputs
run: echo ${{ steps.resolve-release-tag.outputs.TAG }}
update-draft-release:
needs: [build-v2-5-1-alpine-3-13, build-v2-4-10-alpine-3-12, build-v2-4-8-alpine-3-11, build-v2-4-7-alpine-3-10, build-v2-4-6-alpine-3-9, build-v2-4-6-alpine-3-8, build-v2-4-4-alpine-3-7, build-v2-4-4-alpine-3-6, build-v2-3-18-alpine-3-5, build-v2-3-18-alpine-3-4, build-v2-3-18-alpine-3-3, resolve-release-tag]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Print inputs
run: echo ${{ needs.resolve-release-tag.outputs.TAG }}
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
publish: false
name: ${{ needs.resolve-release-tag.outputs.TAG }}
tag: ${{ needs.resolve-release-tag.outputs.TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 2749222

Please sign in to comment.