39 lines
995 B
YAML
39 lines
995 B
YAML
name: Publish Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
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: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Build and push image
|
|
id: push
|
|
uses: docker/build-push-action@v5.0.0
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: sjdonado/url-shortener:latest
|
|
- name: Attest
|
|
uses: actions/attest-build-provenance@v1
|
|
id: attest
|
|
with:
|
|
subject-name: sjdonado/url-shortener
|
|
subject-digest: ${{ steps.push.outputs.digest }}
|