Skip to content

Commit 73a7017

Browse files
committed
Add workflow to update mamolinux/stable branch
1 parent 307afaa commit 73a7017

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Automatically fetch and merge latest tag to mamolinux/stable for new stable releases
2+
name: Update mamolinux/stable branch
3+
4+
# Controls when the action will run.
5+
on:
6+
schedule:
7+
# scheduled every day at 00:00
8+
- cron: '0 0 */1 * *'
9+
10+
workflow_dispatch: # on button click
11+
inputs:
12+
branch:
13+
description: 'Branch to merge to'
14+
required: true
15+
default: 'mamolinux/stable' # set the branch to merge to
16+
17+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
18+
jobs:
19+
# This workflow contains a single job called "sync-new-release"
20+
sync-new-release:
21+
# The type of runner that the job will run on
22+
runs-on: ubuntu-latest
23+
24+
# Steps represent a sequence of tasks that will be executed as part of the job
25+
steps:
26+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
27+
- uses: actions/checkout@master
28+
with:
29+
fetch-depth: 0
30+
31+
# Set default branches when run as scheduled job
32+
- name: Set the branches
33+
env:
34+
DEFAULT_UPSTREAM_BRANCH: 'master' # set the upstream branch to merge from
35+
DEFAULT_BRANCH: 'mamolinux/stable' # set the branch to merge to
36+
run: |
37+
git checkout ${{ env.DEFAULT_UPSTREAM_BRANCH }}
38+
echo "latest-tag=`git log --oneline | cut -d " " -f 2 | grep -E '^[0-9]' | head -1`" >> $GITHUB_ENV
39+
echo "branch=${{ github.event.inputs.branch || env.DEFAULT_BRANCH }}" >> $GITHUB_ENV
40+
41+
- name: Set Git config
42+
run: |
43+
git config --local user.email "actions@github.com"
44+
git config --local user.name "Github Actions"
45+
46+
- name: Update mamolinux/stable for new release
47+
run: |
48+
git checkout ${{ env.branch }}
49+
git merge --ff-only ${{ env.latest-tag }}
50+
git push -f

0 commit comments

Comments
 (0)