Docker Build #113
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
name: Docker Build | |
concurrency: docker | |
on: | |
push: | |
branches: | |
- develop | |
paths: | |
- Dockerfile | |
- scripts/entrypoint.sh | |
workflow_run: | |
workflows: ["CI"] | |
branches: [develop] | |
types: | |
- completed | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: "Get Previous tag" | |
id: previoustag | |
uses: actions-ecosystem/action-get-latest-tag@v1 | |
with: | |
semver_only: true | |
initial_version: v0.0.0 | |
with_initial_version: true | |
- name: Get current date | |
id: getbuilddate | |
run: | | |
echo "::set-output name=date::$(date -u)" | |
echo "::set-output name=isodate::$(date -u '+%Y-%m-%dT%H:%M:%S')" | |
echo "::set-output name=tagdate::$(date -u '+%Y%m%d%H%M%S')" | |
echo "::set-output name=timestamp::$(date -u '+%s')" | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
ghcr.io/pilgrimagesoftware/statesman-slack | |
tags: | | |
type=raw,value=latest | |
type=raw,value=${{ steps.previoustag.outputs.tag }} | |
type=raw,value=${{ steps.getbuilddate.outputs.tagdate }} | |
type=ref,event=branch | |
type=ref,event=tag | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
# context: . | |
push: true | |
no-cache: true | |
tags: ${{ steps.meta.outputs.tags }} | |
build-args: | | |
BUILD_NUMBER=${{ github.run_number }} | |
BUILD_JOB=${{ github.job }} | |
BUILD_SHA=${{ github.sha }} | |
BUILD_DATE=${{ steps.getbuilddate.outputs.isodate }} | |
BUILD_VERSION=${{ steps.previoustag.outputs.tag }} | |
- name: Create Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ vars.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }} | |
with: | |
environment: ${{ vars.SENTRY_ENVIRONMENT }} |