feat: added channel url to output #25
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 app | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- .dockerignore | |
- .github/** | |
- 'api/**' | |
- 'data/**' | |
- 'db/**' | |
- 'lib/**' | |
- 'Dockerfile' | |
- 'Home.py' | |
- 'requirements.txt' | |
env: | |
CACHE_REGISTRY: ghcr.io | |
CACHE_REGISTRY_USER: morriz | |
CACHE_REGISTRY_PASS: ${{ secrets.GITHUB_TOKEN }} | |
TARGET_REGISTRY: docker.io | |
TARGET_REGISTRY_USER: morriz | |
TARGET_REGISTRY_PASS: ${{ secrets.DOCKER_TOKEN }} | |
IMAGE_NAME: morriz/indy-news | |
jobs: | |
api: | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set env | |
# we keep the tag for the cache registry | |
run: | | |
tag=${GITHUB_REF##*/} | |
echo "Creating tag: $tag" | |
echo "TAG=$tag" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the cache registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.CACHE_REGISTRY }} | |
username: ${{ env.CACHE_REGISTRY_USER }} | |
password: ${{ env.CACHE_REGISTRY_PASS }} | |
- name: Log in to the target registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.TARGET_REGISTRY }} | |
username: ${{ env.TARGET_REGISTRY_USER }} | |
password: ${{ env.TARGET_REGISTRY_PASS }} | |
- name: Pull the previous image as cache | |
run: | | |
IMAGE=${{ env.CACHE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} | |
docker pull ${{ env.CACHE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} || true | |
- name: Extract metadata (tags, labels) for target | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=branch | |
- name: Build and push image to target and cache registry | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{ steps.meta.outputs.tags }} | |
${{ env.CACHE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} | |
labels: ${{ steps.meta.outputs.labels }} |