diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..cde9681 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,57 @@ +name: Build + +# Workflow trigger Event +on: + push: + # Publish semver tags as releases. + tags: ['v*.*.*'] + pull_request: + branches: [master] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v4 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/CHANGELOG.md b/CHANGELOG.md index e93e324..37ebbd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Release Notes +## 2.0.0 + +- no changes on the code itself. We now publish the container on ghcr instead of docker hub. +- We move out of beta, we've been running 2.0 without changes in production ## 2.0.0-beta1 diff --git a/Makefile b/Makefile index d8d8fcc..454c08e 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ user=meshcloud name=gate-resource image=$(user)/$(name) -tag=2.0.0-beta1 +tag=$(shell git log --format="%h" -n 1) docker=docker dockerfile = Dockerfile diff --git a/README.md b/README.md index d9e199f..b57ad52 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # gate-resource -[![Build Status](https://img.shields.io/docker/build/meshcloud/gate-resource.svg)](https://hub.docker.com/r/meshcloud/gate-resource/) -[![Docker Pulls](https://img.shields.io/docker/pulls/meshcloud/gate-resource.svg?maxAge=2592000)](https://hub.docker.com/r/meshcloud/gate-resource/) +[![Build](https://github.com/meshcloud/gate-resource/actions/workflows/release.yml/badge.svg)](https://github.com/meshcloud/gate-resource/actions/workflows/release.yml) A generic gate resource for Concourse CI. @@ -9,6 +8,8 @@ Allows you to model quality gates and pipeline control flow. This resource is backed by a Git repository and wraps [git-resource](https://github.com/concourse/git-resource). +A public container build of this repo is available at ghcr.io [meshcloud/gate-resource](https://github.com/meshcloud/gate-resource/pkgs/container/gate-resource). + > Contributors Welcome: This resource is new and hot off the press. We welcome your feedback and contributions! ## Example