|
| 1 | +# Automatically fetch and merge the master branch for new stable releases |
| 2 | +name: Update mamolinux/stable branch |
| 3 | + |
| 4 | +# Controls when the action will run. |
| 5 | +on: |
| 6 | + # Triggers the workflow on push events but only for new tags |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - "*.*.*" |
| 10 | + |
| 11 | + workflow_dispatch: # on button click |
| 12 | + inputs: |
| 13 | + upstream-branch: |
| 14 | + description: 'branch to merge from. Eg. master' |
| 15 | + required: true |
| 16 | + default: 'master' # set the upstream branch to merge from |
| 17 | + branch: |
| 18 | + description: 'Branch to merge to' |
| 19 | + required: true |
| 20 | + default: 'mamolinux/stable' # set the branch to merge to |
| 21 | + |
| 22 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 23 | +jobs: |
| 24 | + # This workflow contains a single job called "sync-new-release" |
| 25 | + sync-new-release: |
| 26 | + # The type of runner that the job will run on |
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 30 | + steps: |
| 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 | + echo "upstream-branch=${{ github.event.inputs.upstream-branch || env.DEFAULT_UPSTREAM_BRANCH }}" >> $GITHUB_ENV |
| 38 | + echo "branch=${{ github.event.inputs.branch || env.DEFAULT_BRANCH }}" >> $GITHUB_ENV |
| 39 | + |
| 40 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 41 | + - uses: actions/checkout@master |
| 42 | + with: |
| 43 | + fetch-depth: 0 |
| 44 | + |
| 45 | + - name: Set Git config |
| 46 | + run: | |
| 47 | + git config --local user.email "[email protected]" |
| 48 | + git config --local user.name "Github Actions" |
| 49 | + |
| 50 | + - name: Update mamolinux/stable for new release |
| 51 | + # with: |
| 52 | + # github_token: ${{ github.token }} |
| 53 | + run: | |
| 54 | + git checkout ${{ env.upstream-branch }} |
| 55 | + git checkout ${{ env.branch }} |
| 56 | + git merge --ff-only ${{ env.upstream-branch }} |
| 57 | + git push -f |
0 commit comments