Skip to content

Publish OWA

Publish OWA #108

Workflow file for this run

name: Publish OWA
on:
schedule:
- cron: "3 15 1 */2 *"
push:
branches: [ "main" ]
paths: [ "src/owa/**", ".github/workflows/publish-owa.yml" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Pull current OWA Docker image
if: github.event_name == 'schedule'
run: docker pull ghcr.io/scolastico-dev/s.containers/owa:latest
- name: Get current OWA Docker image version
if: github.event_name == 'schedule'
id: get-current-version
run: |
version=$(docker inspect --format '{{ index .Config.Labels "OWA_VERSION" }}' ghcr.io/scolastico-dev/s.containers/owa:latest)
echo "CURRENT_VERSION=$version" >> $GITHUB_ENV
- name: Get latest OWA version
id: get-latest-version
run: |
version=$(curl -s https://api.github.com/repos/Open-Web-Analytics/Open-Web-Analytics/releases/latest | jq -r '.tag_name')
echo "LATEST_VERSION=$version" >> $GITHUB_ENV
- name: Checkout repository
if: github.event_name != 'schedule' || env.CURRENT_VERSION != env.LATEST_VERSION
uses: actions/checkout@v2
- name: Extract tags
if: github.event_name != 'schedule' || env.CURRENT_VERSION != env.LATEST_VERSION
run: |
version=${{ env.LATEST_VERSION }}
major=$(echo $version | cut -d. -f1)
minor=$(echo $version | cut -d. -f1-2)
tags="$version,v$minor,v$major"
echo "TAGS=$tags" >> $GITHUB_ENV
- name: Build and push Docker image
if: github.event_name != 'schedule' || env.CURRENT_VERSION != env.LATEST_VERSION
uses: mr-smithers-excellent/docker-build-push@v6
with:
image: s.containers/owa
registry: ghcr.io
directory: ./src/owa/
dockerfile: ./src/owa/Dockerfile
tags: ${{ env.TAGS }},${{ env.LATEST_VERSION }},${{ env.LATEST_VERSION }}-$(date +%Y%m%d)-$(date +%s),latest
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
buildArgs: OWA_VERSION=${{ env.LATEST_VERSION }}