Skip to content

refactor: Add deploy stage to Dockerfile build workflow #12

refactor: Add deploy stage to Dockerfile build workflow

refactor: Add deploy stage to Dockerfile build workflow #12

name: Docker Build and Push to GitHub Container Registry
on:
push:
branches:
- main
jobs:
version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set version variables
id: set-version
run: echo "VERSION=${{ steps.tag_version.outputs.new_version }}" >> $GITHUB_ENV
- name: Display version from tag_version
run: echo "Generated version:${{ steps.tag_version.outputs.new_version }}"
- name: Display version
run: echo ${{ steps.set-version.outputs.VERSION }}
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./InertiaDemo/InertiaDemo/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ steps.tag_version.outputs.new_version }}
ghcr.io/${{ github.repository }}:latest
- name: Image Digest
run: |
echo "Image pushed with digest: ${{ steps.tag_version.outputs.new_version }}"
- name: Deploy Stage
uses: fjogeleit/http-request-action@v1
with:
url: 'https://admin.antosubash.com/api/webhooks/f269109f-2741-4c8a-8af3-9ab3f62f88ce'
method: 'POST'