From e9886efaa2fb981a27f9f376a38269bbbcf2ce55 Mon Sep 17 00:00:00 2001 From: Evgeniy Alekseev Date: Sun, 13 Mar 2022 23:55:21 +0300 Subject: [PATCH] docker hub integration --- .github/workflows/docker-image.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/release.yml | 6 +++++- .github/workflows/run-setup.yml | 1 + .github/workflows/run-tests.yml | 1 + Dockerfile | 10 +++++----- 5 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..3b885e3c --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,29 @@ +name: docker image + +on: + push: + branches: [ master ] + +jobs: + docker-image: + + runs-on: ubuntu-latest + + steps: + - 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: arcan1s/ahriman:latest \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7910e66d..5e576ae1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,20 +12,24 @@ jobs: steps: - uses: actions/checkout@v2 + - name: extract version id: version run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} + - name: create changelog id: changelog uses: jaywcjlove/changelog-generator@main with: token: ${{ secrets.GITHUB_TOKEN }} filter: 'Release \d+\.\d+\.\d+' + - name: create archive run: make archive env: VERSION: ${{ steps.version.outputs.VERSION }} - - name: Release + + - name: release uses: softprops/action-gh-release@v1 with: body: | diff --git a/.github/workflows/run-setup.yml b/.github/workflows/run-setup.yml index e5442c2d..40bd1d7e 100644 --- a/.github/workflows/run-setup.yml +++ b/.github/workflows/run-setup.yml @@ -13,6 +13,7 @@ jobs: steps: - uses: actions/checkout@v2 + - name: setup the service in arch linux container run: | docker run \ diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 584fcde6..875be42e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,6 +13,7 @@ jobs: steps: - uses: actions/checkout@v2 + - name: run check and tests in arch linux container run: | docker run \ diff --git a/Dockerfile b/Dockerfile index fe574c66..50d5d5c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,12 +35,12 @@ RUN runuser -u build -- yay --noconfirm -Sy devtools git pyalpm python-inflectio ## copy tree COPY --chown=build . "/home/build/ahriman" ## create package archive and install it -RUN cd /home/build/ahriman && \ - make VERSION="$(git describe --tags --abbrev=0)" archlinux && \ - cp ./*-src.tar.xz package/archlinux && \ - cd package/archlinux && \ +RUN cd "/home/build/ahriman" && \ + make VERSION=$(python -c "from src.ahriman.version import __version__; print(__version__)") archlinux && \ + cp ./*-src.tar.xz "package/archlinux" && \ + cd "package/archlinux" && \ runuser -u build -- makepkg --noconfirm --install --skipchecksums && \ - cd - && rm -r /home/build/ahriman + cd - && rm -r "/home/build/ahriman" VOLUME ["/var/lib/ahriman"]