Merge pull request #8 from abiddiscombe/dev #7
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: dockerhub | |
on: | |
push: | |
branches: | |
- "main" | |
env: | |
REPO_TAG: "" | |
REPO_NAME: "abiddiscombe/concierge" | |
DOCKER_IMAGE_TAG: "" | |
jobs: | |
DockerBuildAndPush: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: "Fetch latest SemVer tag" | |
id: currentSemVer | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
with: | |
prefix: v | |
- name: Store fetched SemVer tag to REPO_TAG | |
run: echo "REPO_TAG=${{ steps.currentSemVer.outputs.tag }}" >> $GITHUB_ENV | |
- name: Amend REPO_TAG to remove "v" (the first char) | |
run: echo "REPO_TAG=${REPO_TAG#?}" >> $GITHUB_ENV | |
- name: Store image tag to DOCKER_IMAGE_TAG | |
run: echo "DOCKER_IMAGE_TAG=${{ env.REPO_NAME }}:${{ env.REPO_TAG }}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and Push to Docker Hub | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ env.DOCKER_IMAGE_TAG }} |