Skip to content

Commit

Permalink
enh: CI docker pull with version
Browse files Browse the repository at this point in the history
  • Loading branch information
kamarton committed May 25, 2024
1 parent 81d5f86 commit 78c3f66
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/main-versioned-docker-pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: build and pull latest docker image

on:
push:
branches:
- "main"
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(git describe --tags --abbrev=0)
- name: Use the version
run: echo "The current version is ${{ steps.get_version.outputs.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 }}"

0 comments on commit 78c3f66

Please sign in to comment.