Skip to content

Publisher

Publisher #617

Workflow file for this run

name: Publisher
on:
push:
branches:
- main
schedule:
- cron: "0 7 * * *"
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4
- name: Get version
id: rover-version
# release version are prefixed with 'v' in the project
run: |
VERSION="$(gh release list -R apollographql/rover -L 1 | cut -f1 | cut -c2-)"
echo "Latest version is $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
if $(echo $VERSION | grep -Pq '^([1-9]\d*|0)(\.(([1-9]\d*)|0)){2}$'); then echo "NON_PRERELEASE=true" >> $GITHUB_OUTPUT; fi;
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Generate Docker image meta data
id: docker-image-meta-data
uses: docker/metadata-action@v5
with:
images: |
name=worksome/rover,enable=true
tags: |
type=raw,value=${{ steps.rover-version.outputs.VERSION }},enable=true
type=raw,value=latest,enable=${{ (steps.rover-version.outputs.NON_PRERELEASE == 'true') }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
# add 'v' back in to the version again as the rover install command expects it
build-args: version=v${{ steps.rover-version.outputs.version }}
tags: ${{ steps.docker-image-meta-data.outputs.tags}}