Merge pull request #144 from p0nch0d3v/development #58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Docker Hub | |
on: | |
push: | |
branches: | |
- master | |
- development | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: docker-hub | |
steps: | |
- name: Dynamically set DATE_TAG environment variable | |
run: | | |
echo "DATE_TAG=$(date +%Y%m%d-%H%M)" >> $GITHUB_ENV | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ vars.DOCKER_USERNAME }}/${{ vars.DOCKER_REPOSITORY }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
${{ env.DATE_TAG }} | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@v6 | |
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: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
# subject-digest: ${{ steps.push.outputs.digest }} | |
# push-to-registry: true |