Sync upstream & build latest (DockerHub) #888
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: Sync upstream & build latest (DockerHub) | |
on: | |
schedule: | |
- cron: "0 9 * * *" | |
workflow_dispatch: | |
jobs: | |
sync_with_upstream: | |
runs-on: ubuntu-latest | |
name: Sync master with upstream latest | |
steps: | |
# Step 1: run a standard checkout action, provided by github | |
- name: Checkout master | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# persist-credentials: false | |
ref: master | |
fetch-depth: 0 | |
# Step 2: run this sync action - specify the upstream repo, upstream branch to sync with, and target sync branch | |
- name: Pull (Fast-Forward) upstream changes | |
id: sync | |
uses: aormsby/[email protected] | |
with: | |
upstream_sync_repo: xbapps/xbvr | |
upstream_sync_branch: master | |
target_sync_branch: master | |
# target_repo_token: ${{ secrets.SYNC_TOKEN }} | |
target_branch_push_args: '--follow-tags --force' | |
upstream_pull_args: '--tags -f' | |
build-latest: | |
needs: sync_with_upstream | |
runs-on: ubuntu-latest | |
outputs: | |
output1: ${{steps.tagger.outputs.tag}} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Required due to the weg Git works, without it this action won't be able to find any or the correct tags | |
ref: master | |
- name: Find Tag | |
id: tagger | |
uses: jimschubert/query-tag-action@v2 | |
with: | |
exclude: '*beta*' | |
# include: '0.3.*' | |
commit-ish: 'HEAD' | |
# if you unshallow in a separate step, use the following option: | |
skip-unshallow: 'true' | |
- name: Show Tag | |
id: display | |
run: | | |
echo 'Output from Find Tag: ${{steps.tagger.outputs.tag}}' | |
- name: checkout code | |
uses: actions/checkout@v2 | |
with: | |
ref: refs/tags/${{steps.tagger.outputs.tag}} | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: login to docker hub | |
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin | |
- name: build the image | |
run: | | |
git checkout origin/util Dockerfile .yarnrc | |
docker buildx build --build-arg RELVER=${{steps.tagger.outputs.tag}} --build-arg vcs-ref=$(git rev-parse --short HEAD) --push \ | |
--tag iamklh/xbvr:latest \ | |
--platform linux/amd64,linux/arm/v7,linux/arm64 . | |
pushover-actions: | |
needs: build-latest | |
runs-on: ubuntu-latest | |
steps: | |
# - env: | |
# OUTPUT1: ${{needs.build-latest.outputs.output1}} | |
- uses: actions/checkout@v2 # required to clone your code | |
- name: pushover-actions | |
uses: umahmood/pushover-actions@main | |
env: | |
PUSHOVER_TOKEN: ${{ secrets.PUSHOVER_TOKEN }} | |
PUSHOVER_USER: ${{ secrets.PUSHOVER_USER }} | |
with: | |
status: ${{ job.status }} | |
title: 'LATEST deployment ${{steps.tagger.outputs.tag}} COMPLETE' |