47 lines
1.4 KiB
YAML
47 lines
1.4 KiB
YAML
name: Build and Push Docker Container
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ vars.DOCKER_REGISTRY_URL }}
|
|
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
|
|
password: ${{ secrets.ACTION_ACCESS_TOKEN }}
|
|
|
|
- name: Set version
|
|
id: VERSION
|
|
run: echo "VERSION=`cat VERSION`" >> $GITHUB_ENV
|
|
|
|
- name: Convert repository owner to lowercase
|
|
run: echo "REPO_OWNER_LC=$(echo '${{ gitea.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
|
|
|
- name: Build and push Docker image for latest tag
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./build
|
|
push: true
|
|
tags: ${{ vars.DOCKER_REGISTRY_URL }}/${{ env.REPO_OWNER_LC }}/protonmail-bridge:latest
|
|
platforms: linux/amd64
|
|
build-args: |
|
|
VERSION=${{ env.VERSION }}
|
|
|
|
- name: Invoke Portainer Stack Deployment
|
|
if: ${{ vars.PORTAINER_STACK_WEBHOOK_URL && vars.PORTAINER_STACK_WEBHOOK_URL != '' }}
|
|
uses: distributhor/workflow-webhook@v3
|
|
with:
|
|
webhook_url: ${{ vars.PORTAINER_STACK_WEBHOOK_URL }}
|