nightly #198
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: nightly | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
# Manual dispatch, only for testing purposses | |
# See https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow | |
workflow_dispatch: | |
jobs: | |
nightly: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ssh-key: "${{secrets.COMMIT_KEY}}" | |
# Get tag | |
- name: Add upstream repository | |
run: | | |
git remote add versatica https://github.com/versatica/mediasoup.git | |
git remote update --prune | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
# Setup Node.js | |
- name: Node.js | |
uses: actions/setup-node@v3 | |
# Config git user name and email | |
- name: Config git user name and email | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
# Merge and re-tag | |
- name: Merge with upstream | |
id: merge | |
run: | | |
git merge "${{ steps.previoustag.outputs.tag }}" || \ | |
echo "exit_status=$?" >> $GITHUB_OUTPUT | |
- name: Resolve conflicts and fix package name | |
if: ${{ steps.merge.outputs.exit_status }} | |
run: | | |
# Get git-resolve-conflict | |
npm install -g git-resolve-conflict --verbose | |
# package.json | |
git resolve-theirs package.json | |
jq '.name = "@mafalda-sfu/mediasoup"' package.json > package.json.tmp | |
mv package.json.tmp package.json | |
# package-lock.json | |
git resolve-theirs package-lock.json | |
jq '(.name, .packages[""].name) |= "@mafalda-sfu/mediasoup"' \ | |
package-lock.json > package-lock.json.tmp | |
mv package-lock.json.tmp package-lock.json | |
# Commit | |
git add package.json package-lock.json | |
git commit --no-edit | |
- name: Tag and push | |
run: | | |
git push | |
git tag --force "${{ steps.previoustag.outputs.tag }}" | |
git push --force --tags |