Skip to content

Commit

Permalink
chore: update CI workflow to use Ubuntu 24.04
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiinaKin committed Dec 14, 2024
1 parent 33bdf47 commit 7e8791d
Showing 1 changed file with 62 additions and 63 deletions.
125 changes: 62 additions & 63 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- name: Checkout code
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
retention-days: 1

release:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
if: startsWith(github.ref, 'refs/tags/')
needs: build
permissions:
Expand All @@ -66,19 +66,18 @@ jobs:
path: build

- name: Get Previous Release Tag
id: get_previous_tag
uses: InsonusK/[email protected]
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
exclude_types: draft,prerelease
run: |
git fetch --tags --force
previous_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))
echo "previous_tag=$previous_tag" >> $GITHUB_ENV
- name: Generate Changelog
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
output: CHANGELOG.md
sinceTag: ${{ env.previous_tag }}
stripGeneratorNotice: true
sinceTag: ${{ steps.get_previous_tag.outputs.tag_name }}
headerLabel: "## Good things have arrived"

- name: Release
Expand All @@ -91,58 +90,58 @@ jobs:
# https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images
# https://docs.docker.com/build/ci/github-actions/multi-platform/
# https://github.com/docker/build-push-action
build-and-push-docker-image:
runs-on: ubuntu-latest
needs: release
permissions:
packages: write
attestations: write
id-token: write

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Github Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.DOCKER_HUB_REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and Push Docker Image
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
# build-and-push-docker-image:
# runs-on: ubuntu-24.04
# needs: release
# permissions:
# packages: write
# attestations: write
# id-token: write
#
# steps:
# - name: Checkout repo
# uses: actions/checkout@v4
#
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
#
# - name: Log in to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
#
# - name: Log in to the Github Container registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.GHCR_REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Docker meta
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: |
# ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
# ${{ env.DOCKER_HUB_REGISTRY }}/${{ env.IMAGE_NAME }}
#
# - name: Build and Push Docker Image
# id: push
# uses: docker/build-push-action@v6
# with:
# context: .
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# platforms: linux/amd64,linux/arm64
#
# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v1
# with:
# subject-name: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME}}
# subject-digest: ${{ steps.push.outputs.digest }}
# push-to-registry: true

0 comments on commit 7e8791d

Please sign in to comment.