|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + |
| 5 | +permissions: |
| 6 | + contents: write |
| 7 | + packages: write |
| 8 | + |
| 9 | +jobs: |
| 10 | + release: |
| 11 | + name: Create Release |
| 12 | + runs-on: ubuntu-latest |
| 13 | + env: |
| 14 | + IMAGE_NAME: ghcr.io/gardenlinux/glvd-postgres |
| 15 | + IMAGE_NAME_ORG: gardenlinux |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v5 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Determine Version to Release |
| 24 | + id: version |
| 25 | + run: echo "VERSION=$(date --utc +%Y.%m.%d)" >> $GITHUB_ENV |
| 26 | + |
| 27 | + - name: Set Version |
| 28 | + run: echo $VERSION > version.txt |
| 29 | + |
| 30 | + - name: Configure git |
| 31 | + run: | |
| 32 | + git config --global user.name "github-actions[bot]" |
| 33 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 34 | +
|
| 35 | + - name: Commit version.txt to branch |
| 36 | + run: | |
| 37 | + git checkout -b release-version-${VERSION} |
| 38 | + git add version.txt |
| 39 | + git commit -m "chore: set version to ${VERSION}" |
| 40 | + git tag $VERSION |
| 41 | + git push --tags origin release-version-${VERSION} |
| 42 | +
|
| 43 | + - name: Install qemu dependency for multi-arch build |
| 44 | + run: | |
| 45 | + sudo apt-get update |
| 46 | + sudo apt-get install -y qemu-user-static |
| 47 | +
|
| 48 | + - name: Build Image |
| 49 | + id: build_image |
| 50 | + uses: redhat-actions/buildah-build@v2 |
| 51 | + with: |
| 52 | + image: ${{ env.IMAGE_NAME_ORG }}/${{ env.IMAGE_NAME }} |
| 53 | + tags: ${{ env.VERSION }} |
| 54 | + platforms: linux/amd64, linux/arm64 |
| 55 | + containerfiles: | |
| 56 | + ./Containerfile |
| 57 | +
|
| 58 | + - name: Echo Outputs |
| 59 | + run: | |
| 60 | + echo "Image: ${{ steps.build_image.outputs.image }}" |
| 61 | + echo "Tags: ${{ steps.build_image.outputs.tags }}" |
| 62 | + echo "Tagged Image: ${{ steps.build_image.outputs.image-with-tag }}" |
| 63 | +
|
| 64 | + - name: Check images created |
| 65 | + run: buildah images | grep '${{ env.IMAGE_NAME }}' |
| 66 | + |
| 67 | + - name: Check manifest |
| 68 | + run: | |
| 69 | + set -x |
| 70 | + buildah manifest inspect ${{ steps.build_image.outputs.image }}:${{ env.VERSION }} |
| 71 | +
|
| 72 | + - name: Push To ghcr.io |
| 73 | + id: push-to-ghcr |
| 74 | + uses: redhat-actions/push-to-registry@v2 |
| 75 | + with: |
| 76 | + image: ${{ steps.build_image.outputs.image }} |
| 77 | + tags: ${{ steps.build_image.outputs.tags }} |
| 78 | + registry: ghcr.io |
| 79 | + username: ${{ github.actor }} |
| 80 | + password: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments