release: 0.4.0 #9
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: build and pull latest or versioned docker image | |
on: | |
push: | |
branches: | |
- "main" | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get the version | |
id: get_version | |
run: | | |
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo 'latest') | |
echo ::set-output name=VERSION::${VERSION} | |
- name: Write version to webapp | |
run: echo "VITE_APP_VERSION=${{ steps.get_version.outputs.VERSION }}" >> webapp/.env.production | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: "${{ secrets.DOCKERHUB_USERNAME }}/httpymonitor:${{ steps.get_version.outputs.VERSION }}" |