ci: Add workflows (#1)
This commit is contained in:
parent
b61b880904
commit
4da5e53982
2 changed files with 111 additions and 0 deletions
45
.github/workflows/build_n_push.yml
vendored
Normal file
45
.github/workflows/build_n_push.yml
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
name: "Build and push"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build_n_push:
|
||||
name: Build and push
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: jsondoe9/metube
|
||||
tags: |
|
||||
type=sha,prefix=sha-,format=short
|
||||
type=raw,value=latest,enable=true
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
66
.github/workflows/upstream_sync.yaml
vendored
Normal file
66
.github/workflows/upstream_sync.yaml
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
name: "Upstream Sync"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '1 0 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
sync:
|
||||
name: Sync with upstream
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
has_new_commits: ${{ steps.sync.outputs.has_new_commits }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: sync/master
|
||||
|
||||
- name: Sync changes with upstream
|
||||
id: sync
|
||||
uses: aormsby/Fork-Sync-With-Upstream-action@v3.2
|
||||
with:
|
||||
target_sync_branch: sync/master
|
||||
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
upstream_sync_branch: master
|
||||
upstream_sync_repo: alexta69/metube
|
||||
|
||||
- name: New commits found
|
||||
if: steps.sync.outputs.has_new_commits == 'true'
|
||||
run: echo "New commits were found to sync."
|
||||
|
||||
- name: No new commits found
|
||||
if: steps.sync.outputs.has_new_commits == 'false'
|
||||
run: echo "There were no new commits."
|
||||
|
||||
pr:
|
||||
name: Create PR for upstream changes
|
||||
runs-on: ubuntu-latest
|
||||
needs: sync
|
||||
if: needs.sync.outputs.has_new_commits == 'true'
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: master
|
||||
|
||||
- name: Reset sync/master branch
|
||||
run: |
|
||||
git fetch origin sync/master:sync/master
|
||||
git reset --hard sync/master
|
||||
|
||||
- name: Create pull request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
branch: upstream-changes
|
||||
title: "[sync] Changes from upstream"
|
||||
body: |
|
||||
Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request)
|
||||
labels: |
|
||||
automated
|
||||
delete-branch: true
|
||||
Loading…
Reference in a new issue