Monthly Update tModLoader #6
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: Monthly Update tModLoader | |
# Branch Names | |
env: | |
DevBranch: 1.4.4 | |
StableBranch: stable | |
PreviewBranch: preview | |
# Controls when the action will run. | |
on: | |
# This workflow runs on the first of every month at midnight UTC | |
schedule: | |
- cron: '0 0 1 * *' | |
# Allows you to manually run the workflow | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow replaces $StableBranch with a copy of $PreviewBranch, destroying anything on it prior | |
MergeToStable: | |
# 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: | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
with: | |
ref: 'refs/heads/${{env.StableBranch}}' | |
token: ${{ secrets.TMODLOADERBOT_TOKEN }} | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Merge | |
run: | | |
token=${{ secrets.TMODLOADERBOT_TOKEN }} | |
repo=$GITHUB_REPOSITORY | |
git config user.name github-actions | |
git config user.email [email protected] | |
git remote set-url origin https://x-access-token:[email protected]/$repo.git | |
git reset --hard origin/${{env.PreviewBranch}} | |
git push --force origin ${{env.StableBranch}} | |
# This workflow replaces $PreviewBranch with a copy of $DevBranch, destroying anything on it prior | |
MergeToPreview: | |
# Needs should be ensuring this doesn't run if the last job failed. | |
needs: MergeToStable | |
# 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: | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
with: | |
ref: 'refs/heads/${{env.PreviewBranch}}' | |
token: ${{ secrets.TMODLOADERBOT_TOKEN }} | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Merge | |
run: | | |
token=${{ secrets.TMODLOADERBOT_TOKEN }} | |
repo=$GITHUB_REPOSITORY | |
git config user.name github-actions | |
git config user.email [email protected] | |
git remote set-url origin https://x-access-token:[email protected]/$repo.git | |
git reset --hard origin/${{env.DevBranch}} | |
git push --force origin ${{env.PreviewBranch}} |