From 3d71057b60316b694f612e75ef79e0821832c130 Mon Sep 17 00:00:00 2001 From: Juan Osorio Robles Date: Thu, 14 Apr 2022 10:11:21 +0300 Subject: [PATCH] Add release workflow (#13) This workflow will track the semver tags and build the container image for audittail. Signed-off-by: Juan Antonio Osorio --- .github/workflows/release.yml | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..e7851836 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: Release + +on: + push: + tags: + - v** + +env: + AUDITTAIL_IMAGE_NAME: ghcr.io/metal-toolbox/audittail + +jobs: + container: + runs-on: ubuntu-latest + + permissions: + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v3.0.0 + + - name: Login to ghcr.io + uses: docker/login-action@v1.14.1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build container images + run: | + revision="$(git rev-parse "${GITHUB_REF_NAME:-HEAD}")" + docker build \ + -f ./images/audittail/Containerfile \ + -t "${AUDITTAIL_IMAGE_NAME}:latest" \ + -t "${AUDITTAIL_IMAGE_NAME}:${GITHUB_REF_NAME}" \ + -t "${AUDITTAIL_IMAGE_NAME}:${revision}" \ + --label "org.opencontainers.image.source=https://github.com/metal-toolbox/auditevent" \ + --label "org.opencontainers.image.created=$(date --iso-8601=seconds)" \ + --label "org.opencontainers.image.title=audittail" \ + --label "org.opencontainers.image.revision=${revision}" \ + --label "org.opencontainers.image.version=${GITHUB_REF_NAME}" \ + --label "org.opencontainers.image.licenses=MIT" \ + --label "org.opencontainers.image.vendor=Equinix, Inc." \ + . + + - name: Publish Container images + run: docker push "${AUDITTAIL_IMAGE_NAME}" --all-tags \ No newline at end of file