From 74209acc2142b5d3caf95d4b3a5a7e13fd6d0480 Mon Sep 17 00:00:00 2001 From: Evgeniy Alekseev Date: Sun, 27 Aug 2023 23:07:20 +0300 Subject: [PATCH] ci: publish docker image to ghcr --- .github/workflows/docker-image.yml | 42 --------------- .github/workflows/docker.yml | 51 +++++++++++++++++++ .github/workflows/release.yml | 12 ++--- .../workflows/{run-setup.yml => setup.yml} | 10 ++-- .../workflows/{run-tests.yml => tests.yml} | 6 +-- README.md | 6 +-- 6 files changed, 68 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/docker-image.yml create mode 100644 .github/workflows/docker.yml rename .github/workflows/{run-setup.yml => setup.yml} (74%) rename .github/workflows/{run-tests.yml => tests.yml} (74%) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index ef13aceb..00000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: docker image - -on: - push: - branches: [ master ] - tags: - - '*' - - '!*rc*' - -jobs: - docker-image: - - runs-on: ubuntu-latest - - steps: - - name: extract docker metadata - id: meta - uses: docker/metadata-action@v3 - with: - images: | - arcan1s/ahriman - tags: | - type=ref,event=tag - type=edge - - - name: setup QEMU - uses: docker/setup-qemu-action@v1 - - - name: setup docker buildx - uses: docker/setup-buildx-action@v1 - - - name: login to docker hub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: build an image and push - uses: docker/build-push-action@v2 - with: - push: true - tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..70aeda56 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,51 @@ +name: Docker image + +on: + push: + branches: [ master ] + tags: + - '*' + - '!*rc*' + +jobs: + docker-image: + + runs-on: ubuntu-latest + + permissions: + packages: write + + steps: + - uses: docker/setup-qemu-action@v2 + + - uses: docker/setup-buildx-action@v2 + + - name: Login to docker hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to github container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract docker metadata + id: meta + uses: docker/metadata-action@v3 + with: + images: | + arcan1s/ahriman + ghcr.io/arcan1s/ahriman + tags: | + type=semver,pattern={{raw}} + type=edge + + - name: Build an image and push + uses: docker/build-push-action@v4 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6ca75500..b6d4bd40 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: release +name: Release on: push: @@ -11,25 +11,25 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: extract version + - name: Extract version id: version run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} - - name: create changelog + - name: Create changelog id: changelog uses: jaywcjlove/changelog-generator@main with: token: ${{ secrets.GITHUB_TOKEN }} filter: 'Release \d+\.\d+\.\d+' - - name: create archive + - name: Create archive run: make archive env: VERSION: ${{ steps.version.outputs.VERSION }} - - name: release + - name: Publish release uses: softprops/action-gh-release@v1 with: body: | diff --git a/.github/workflows/run-setup.yml b/.github/workflows/setup.yml similarity index 74% rename from .github/workflows/run-setup.yml rename to .github/workflows/setup.yml index ff783723..9f03bb8e 100644 --- a/.github/workflows/run-setup.yml +++ b/.github/workflows/setup.yml @@ -1,4 +1,4 @@ -name: setup +name: Setup on: push: @@ -18,9 +18,9 @@ jobs: options: --privileged -w /build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: setup the minimal service in arch linux container + - name: Setup the minimal service in arch linux container run: .github/workflows/setup.sh minimal run-setup: @@ -34,7 +34,7 @@ jobs: options: --privileged -w /build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: setup the service in arch linux container + - name: Setup the service in arch linux container run: .github/workflows/setup.sh diff --git a/.github/workflows/run-tests.yml b/.github/workflows/tests.yml similarity index 74% rename from .github/workflows/run-tests.yml rename to .github/workflows/tests.yml index bfbf56bb..7a43434e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: tests +name: Tests on: push: @@ -18,7 +18,7 @@ jobs: options: -w /build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: run check and tests in arch linux container + - name: Run check and tests in arch linux container run: .github/workflows/tests.sh diff --git a/README.md b/README.md index dbb3a2bb..3a03136b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # ArcH linux ReposItory MANager -[![tests status](https://github.com/arcan1s/ahriman/actions/workflows/run-tests.yml/badge.svg)](https://github.com/arcan1s/ahriman/actions/workflows/run-tests.yml) -[![setup status](https://github.com/arcan1s/ahriman/actions/workflows/run-setup.yml/badge.svg)](https://github.com/arcan1s/ahriman/actions/workflows/run-setup.yml) -[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/arcan1s/ahriman?label=docker%20image)](https://hub.docker.com/r/arcan1s/ahriman) +[![tests status](https://github.com/arcan1s/ahriman/actions/workflows/tests.yml/badge.svg)](https://github.com/arcan1s/ahriman/actions/workflows/run-tests.yml) +[![setup status](https://github.com/arcan1s/ahriman/actions/workflows/setup.yml/badge.svg)](https://github.com/arcan1s/ahriman/actions/workflows/run-setup.yml) +[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/arcan1s/ahriman?label=Docker%20image)](https://hub.docker.com/r/arcan1s/ahriman) [![CodeFactor](https://www.codefactor.io/repository/github/arcan1s/ahriman/badge)](https://www.codefactor.io/repository/github/arcan1s/ahriman) [![Documentation Status](https://readthedocs.org/projects/ahriman/badge/?version=latest)](https://ahriman.readthedocs.io/?badge=latest)