Skip to content

Merge pull request #85 from oasisprotocol/ptrus/feature/rofl-cli-spli… #61

Merge pull request #85 from oasisprotocol/ptrus/feature/rofl-cli-spli…

Merge pull request #85 from oasisprotocol/ptrus/feature/rofl-cli-spli… #61

Workflow file for this run

name: docker # This name appears in GitHub's Checks API and in workflow's status badge.
# THIS WORKFLOW:
# Builds and pushes a Docker image at the current commit.
# This image is only offered for manual testing/debugging of a given PR/commit.
# It is not a dependency of any automated process.
on:
push:
branches:
- master
paths-ignore: # Do not trigger if _only_ these files were changed.
- .punch_version.py
- .changelog/*.md
- CHANGELOG.md
workflow_dispatch: # manual; for debugging workflow before merging branch into `master`
permissions:
packages: write
contents: read
jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
# Fetch all history so gitlint can check the relevant commits.
fetch-depth: '0'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Compute version
# Version oasis-indexer image by date and git revision.
run: |
echo "VERSION=$(date +%Y-%m-%d-git$(git rev-parse --short HEAD))" >> $GITHUB_ENV
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker to ghcr.io
uses: docker/build-push-action@v6
with:
build-args: |
VERSION=${{ env.VERSION }}
context: .
file: docker/Dockerfile
tags: |
ghcr.io/oasisprotocol/rofl-app-backend:latest
ghcr.io/oasisprotocol/rofl-app-backend:latest-${{ env.VERSION }}
push: true
provenance: false
cache-from: type=gha
cache-to: type=gha,mode=max
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Prune old ghcr.io/oasisprotocol/rofl-app-backend images
if: ${{ github.event_name == 'push' }}
uses: vlaurin/action-ghcr-prune@v0.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
organization: oasisprotocol
container: rofl-app-backend
keep-younger-than: 14 # days
keep-last: 4
prune-untagged: true
prune-tags-regexes: ^latest-