Skip to content

Commit

Permalink
auto-sync upstream and update stable branch
Browse files Browse the repository at this point in the history
- Automatically sync upstream master branch
  and all tags everyday at 00:00
- Update mamolinux/stable branch with latest tag
  • Loading branch information
hsbasu committed Jan 30, 2025
1 parent caa821b commit 6a0ac75
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/auto-sync-upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Automatically fetch and merge upstream master branch and tags

name: Scheduled Sync Upstream Action
on:
schedule:
# scheduled once a day
- cron: '0 0 */1 * *'

workflow_dispatch: # on button click
inputs:
upstream:
description: 'Upstream repository (eg. linuxmint/cinnamon)'
required: true
default: 'wimpysworld/deb-get' # set the upstream repo
upstream-branch:
description: 'Upstream branch to merge from. Eg. master'
required: true
default: 'main' # set the upstream branch to merge from
branch:
description: 'Branch to merge to'
required: true
default: 'main' # set the branch to merge to

jobs:
# This workflow contains a single job called "sync-upstream"
sync-upstream:
runs-on: ubuntu-latest
steps:
# Set default branches when run as scheduled job
- name: Set the branches
env:
DEFAULT_UPSTREAM: 'wimpysworld/deb-get' # set the upstream repo
DEFAULT_UPSTREAM_BRANCH: 'main' # set the upstream branch to merge from
DEFAULT_BRANCH: 'main' # set the branch to merge to
run: |
echo "upstream=${{ github.event.inputs.upstream || env.DEFAULT_UPSTREAM }}" >> $GITHUB_ENV
echo "upstream-branch=${{ github.event.inputs.upstream-branch || env.DEFAULT_UPSTREAM_BRANCH }}" >> $GITHUB_ENV
echo "branch=${{ github.event.inputs.branch || env.DEFAULT_BRANCH }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.branch }} # set the branch to merge to
# Number of commits to fetch. 0 indicates all history for all branches and tags.
fetch-depth: 0

- name: Fetch and Merge Upstream Branch
uses: exions/merge-upstream@v1
with:
upstream: ${{ env.upstream }}
upstream-branch: ${{ env.upstream-branch }}
branch: ${{ env.branch }}
token: ${{ secrets.TOKEN }}

- name: Push All Tags
run: |
git push origin --tags
53 changes: 53 additions & 0 deletions .github/workflows/update-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Automatically fetch and merge latest tag to mamolinux/stable for new stable releases
name: Update mamolinux/stable branch

# Controls when the action will run.
on:
push:
tags: ['*']

workflow_dispatch: # on button click
inputs:
branch:
description: 'Branch to merge to'
required: true
default: 'mamolinux/stable' # set the branch to merge to

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "sync-new-release"
sync-new-release:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@master
with:
fetch-depth: 0

# Set default branches when run as scheduled job
- name: Set the branches
env:
DEFAULT_UPSTREAM_BRANCH: 'main' # set the upstream branch to merge from
DEFAULT_BRANCH: 'mamolinux/stable' # set the branch to merge to
run: |
git checkout ${{ env.DEFAULT_UPSTREAM_BRANCH }}
echo "latest-tag=`git describe --abbrev=0 --tags`" >> $GITHUB_ENV
echo "branch=${{ github.event.inputs.branch || env.DEFAULT_BRANCH }}" >> $GITHUB_ENV
- name: Set Git config
run: |
git config --local user.email "actions@github.com"
git config --local user.name "Github Actions"
- name: Update mamolinux/stable for new release
run: |
git branch -D ${{ env.branch }}
git checkout -b ${{ env.branch }} ${{ env.latest-tag }}
sudo apt-get -y update
sudo apt-get -y install debhelper devscripts
REL_VER=$(grep "^readonly VERSION" deb-get | cut -d'"' -f2)
dch -v "${REL_VER}-1" --distribution=unstable "New upstream release."
git push -f origin ${{ env.branch }}

0 comments on commit 6a0ac75

Please sign in to comment.