build: 🏗️ docker action test

This commit is contained in:
log1997
2025-12-19 16:07:50 +08:00
parent 8b7745b478
commit 2218caf713
4 changed files with 82 additions and 24 deletions

53
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Publish Docker image
on:
push:
tags:
- 'v*'
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: log-lottery
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: index.docker.io/${{ secrets.DOCKER_USERNAME }}/log-lottery
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

View File

@@ -1,17 +1,16 @@
name: Build and Release
on:
push:
tags:
- 'v*'
pull_request:
branches: [main]
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
@@ -26,8 +25,8 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '22.x'
cache: 'pnpm'
node-version: 22.x
cache: pnpm
- name: Install dependencies
run: pnpm install
@@ -59,4 +58,4 @@ jobs:
dist-file.tar.gz
draft: true
prerelease: false
generate_release_notes: true
generate_release_notes: true