Docker build stash image #20345
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: Docker build stash image | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 * * * *" | |
push: | |
paths: | |
- '.github/workflows/docker-build-stash.yml' | |
- 'stash/**' | |
jobs: | |
build: | |
runs-on: ${{ (github.event_name == 'push') && fromJSON('[ "buildjet-4vcpu-ubuntu-2204-arm" ]') || 'ubuntu-latest' }} | |
steps: | |
- name: Get latest tag | |
id: get-latest-tag | |
run: | | |
echo "tag=$(git ls-remote --refs --tags https://github.com/stashed/stash.git|cut --delimiter='/' --fields=3|sort --version-sort|tail --lines=1)" >> $GITHUB_ENV | |
shell: bash | |
- uses: actions/cache@v2 | |
id: cache | |
with: | |
path: stash | |
key: ${{ runner.os }}-v1-${{ env.tag }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
platforms: all | |
- name: Check Out Repo | |
uses: actions/checkout@v3 | |
- name: Check Out Repo stashed/stash | |
uses: actions/checkout@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
repository: "stashed/stash" | |
ref: '${{ env.tag }}' | |
path: 'stash-git' | |
- name: Set up Docker Buildx | |
if: steps.cache.outputs.cache-hit != 'true' | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: latest | |
- name: Replace rest by rclone and copy modified Dockerfile | |
id: replace-copy | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
sed -i 's/rest:/rclone:/' stash-git/vendor/stash.appscode.dev/apimachinery/pkg/restic/setup.go | |
cp stash/Dockerfile.in stash-git/Dockerfile.in | |
shell: bash | |
- name: Publish docker image | |
if: steps.cache.outputs.cache-hit != 'true' | |
env: | |
REGISTRY: quay.io/unixfox | |
DOCKER_TOKEN: ${{ secrets.QUAY_PASSWORD }} | |
USERNAME: ${{ secrets.QUAY_USERNAME }} | |
APPSCODE_ENV: prod | |
run: | | |
docker login quay.io --username ${USERNAME} --password ${DOCKER_TOKEN} | |
cd stash-git && make release |