Skip to content

Commit

Permalink
build(docker): upload image to docker hub (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
xensik authored Mar 16, 2024
1 parent 30ec683 commit 2c9850c
Showing 1 changed file with 62 additions and 7 deletions.
69 changes: 62 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,14 @@ jobs:
name: Deploy Release
runs-on: ubuntu-latest
needs: [ build-windows, build-macos, build-linux ]
if: startsWith(github.ref, 'refs/tags/')
if: github.ref_type == 'tag'
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
sparse-checkout: |
Dockerfile
README.md
sparse-checkout-cone-mode: false

- name: Download Binaries
Expand All @@ -214,10 +215,64 @@ jobs:
*.zip
*.tar.gz
- name: Build and Publish Docker Image
uses: VaultVulp/gp-docker-action@1.6.0
# - name: Setup Cosign
# if: github.event_name != 'pull_request'
# uses: sigstore/cosign-installer@v3.1.1
# with:
# cosign-release: 'v2.1.1'

# - name: Setup QEMU
# uses: docker/setup-qemu-action@v3.0.0
# with:
# platforms: linux/amd64,linux/arm64

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.0.0

- name: Login to DockerHub
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3.0.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- id: meta
uses: docker/metadata-action@v5.4.0
with:
images: |
xensik/gsc-tool
ghcr.io/xensik/gsc-tool
tags: |
${{ github.ref == 'refs/tags/' && github.ref_name || github.ref }}
latest
- name: Build and Push Docker Image
id: build-and-push
uses: docker/build-push-action@v5.1.0
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Update DockerHub Information
uses: peter-evans/dockerhub-description@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: gsc-tool
extract-git-tag: true
additional-image-tags: latest
repository: xensik/gsc-tool
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# - name: Sign the published Docker image
# env:
# TAGS: ${{ steps.meta.outputs.tags }}
# DIGEST: ${{ steps.build-and-push.outputs.digest }}
# run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

0 comments on commit 2c9850c

Please sign in to comment.