Skip to content

Merge pull request #1 from StarTrooper08/remove-slimtoolkit #26

Merge pull request #1 from StarTrooper08/remove-slimtoolkit

Merge pull request #1 from StarTrooper08/remove-slimtoolkit #26

Workflow file for this run

name: Build, Optimize and Publish Docker Image to Github Registry
on:
push:
branches: ['main']
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Github Repo
uses: actions/checkout@v3
- name: Set version number from release
if: ${{ github.event_name == 'release' }}
run: |
echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
- name: Log in to Github Image Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
CONTAINER_VERSION=${{ env.VERSION }}
labels: ${{ steps.meta.outputs.tags }}
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build Image
shell: bash
run: docker build . -t atharvas08/hashcraft:latest
- name: Docker Push
shell: bash
run: docker push atharvas08/hashcraft:latest