From a9d30a0f9a50010b10945f4c362afc3bb1a13e32 Mon Sep 17 00:00:00 2001 From: Eike Waldt Date: Tue, 22 Oct 2024 11:08:05 +0200 Subject: [PATCH] build release pipeline --- .../workflows/{image.yml => image-dev.yml} | 11 ++- .github/workflows/image-release.yml | 79 +++++++++++++++++++ VERSION | 1 + setup.py | 3 +- 4 files changed, 86 insertions(+), 8 deletions(-) rename .github/workflows/{image.yml => image-dev.yml} (92%) create mode 100644 .github/workflows/image-release.yml create mode 100644 VERSION diff --git a/.github/workflows/image.yml b/.github/workflows/image-dev.yml similarity index 92% rename from .github/workflows/image.yml rename to .github/workflows/image-dev.yml index 59eac0a..bd878aa 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image-dev.yml @@ -1,9 +1,10 @@ - -name: publish GLRD container image +name: dev GLRD container image on: workflow_dispatch: push: - branches: + # tags: + # - 'v[0-9]+.[0-9]+.[0-9]+' + branches-ignore: - main paths: - bin/** @@ -24,8 +25,6 @@ jobs: arch: [ amd64, arm64 ] steps: - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - uses: ./.github/actions/setup - name: podman login run: | @@ -73,4 +72,4 @@ jobs: podman manifest add ghcr.io/${{ github.repository }} oci-archive:/tmp/arm64-oci.tar - name: podman push run: | - podman manifest push ghcr.io/${{ github.repository }} docker://ghcr.io/${{ github.repository }} + podman manifest push ghcr.io/${{ github.repository }} docker://ghcr.io/${{ github.repository }}:dev diff --git a/.github/workflows/image-release.yml b/.github/workflows/image-release.yml new file mode 100644 index 0000000..bc2484d --- /dev/null +++ b/.github/workflows/image-release.yml @@ -0,0 +1,79 @@ +name: release GLRD container image +on: + workflow_dispatch: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + # paths: + # - bin/** + # - glrd/** + # - Containerfile + # - requirements.txt + # - setup.py +jobs: + build: + name: build + runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-latest-arm' || 'ubuntu-latest' }} + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + arch: [ amd64, arm64 ] + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + - name: set version + run: | + version=$(echo ${{ github.ref_name }} | cut -d'v' -f2) + echo ${version} >VERSION + - name: podman login + run: | + podman login -u token -p ${{ github.token }} ghcr.io + - name: podman build + run: | + podman build --platform linux/${{ matrix.arch }} -t glrd . + - name: podman build + run: | + podman save --format oci-archive glrd >/tmp/${{ matrix.arch }}-oci.tar + - name: upload build-${{ matrix.arch }} + uses: actions/upload-artifact@v4 + with: + name: build-${{ matrix.arch }} + path: /tmp/${{ matrix.arch }}-oci.tar + if-no-files-found: error + retention-days: 1 + push: + name: push + runs-on: 'ubuntu-latest' + defaults: + run: + shell: bash + needs: build + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + - name: download build-amd64 + uses: actions/download-artifact@v4 + with: + name: build-amd64 + path: /tmp + - name: download build-arm64 + uses: actions/download-artifact@v4 + with: + name: build-arm64 + path: /tmp + - name: podman login + run: | + podman login -u token -p ${{ github.token }} ghcr.io + - name: podman manifest + run: | + podman manifest create ghcr.io/${{ github.repository }} + podman manifest add ghcr.io/${{ github.repository }} oci-archive:/tmp/amd64-oci.tar + podman manifest add ghcr.io/${{ github.repository }} oci-archive:/tmp/arm64-oci.tar + - name: podman push + run: | + version=${{ github.ref_name }} + podman manifest push ghcr.io/${{ github.repository }} docker://ghcr.io/${{ github.repository }}:latest + podman manifest push ghcr.io/${{ github.repository }} docker://ghcr.io/${{ github.repository }}:${version} diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..77d6f4c --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/setup.py b/setup.py index 3c64c7c..6710333 100644 --- a/setup.py +++ b/setup.py @@ -9,12 +9,11 @@ def read_file(file): return f.read() long_description = read_file("README.md") -# version = read_file("VERSION") +version = read_file("VERSION") requirements = read_requirements("requirements.txt") setup( name="glrd", - # version="1.0", author = 'Garden Linux Maintainers', description = 'Garden Linux Release Database', long_description = long_description,