added arg for publishing with latest tag #6
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: Docker Hub Publish | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
IMAGE_NAME: asouchereau/vaultwarden-backup-gfs | |
jobs: | |
push_dockerhub: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
run: | | |
echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | |
- name: Get version | |
run: | | |
export VERSION=$(cat version.txt) | |
echo "VERSION=$VERSION" >> "$GITHUB_ENV" | |
echo "Version: $VERSION" | |
- name: Build and tag image | |
run: docker build -t $IMAGE_NAME:$VERSION -t $IMAGE_NAME:latest . | |
- name: Push image to GHCR | |
run: docker push $IMAGE_NAME --all-tags |