forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate pulling latest master branch & tags, and creating new releas…
…e branches (#7) * Automate pulling latest master branch & tags, and creating new release branches
- Loading branch information
1 parent
9c72ed9
commit ae0d070
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Pull in latest master branch and tags from official Prebid.js repo, trigger auto-release-branch if there are new tags | ||
name: auto-pull-upstream | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 8 * * *' | ||
|
||
jobs: | ||
pull: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
token: '${{ secrets.JENKINS_GITHUB_TOKEN }}' | ||
fetch-depth: 0 | ||
- name: Pull | ||
run: | | ||
git config --local user.email "action@github.com" | ||
git config --local user.name "GitHub Action" | ||
git checkout master | ||
git remote add upstream https://github.com/prebid/Prebid.js.git | ||
git pull upstream master | ||
git fetch upstream --tags | ||
NEW_VERSIONS=$(git show-ref --tags | grep -v -F "$(git ls-remote --tags origin | grep -v '\^{}' | cut -f 2)" | cut -d "/" -f 3) | ||
git push origin master --tags | ||
for version in $NEW_VERSIONS | ||
# Trigger auto-release-branch workflow | ||
do | ||
curl \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-u jenkins-openx:${{ secrets.JENKINS_GITHUB_TOKEN }} \ | ||
https://api.github.com/repos/openx/prebid-js-internal/actions/workflows/auto-release-branch.yml/dispatches \ | ||
-d '{"ref":"openx/master", "inputs": {"tag": "'"$version"'" }}' | ||
done | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Create a release branch when there is a new official tag | ||
name: auto-release-branch | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'Official tag to be used in making a release branch/tag' | ||
|
||
jobs: | ||
make-release-branch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.JENKINS_GITHUB_TOKEN }} | ||
- name: Create release branch | ||
run: | | ||
git config --local user.email "action@github.com" | ||
git config --local user.name "GitHub Action" | ||
VERSION=${{ github.event.inputs.tag }} | ||
echo $VERSION | ||
git fetch -unf origin $VERSION:refs/tags/$VERSION | ||
git checkout $VERSION | ||
git checkout -b openx/$VERSION | ||
git fetch -unf origin openx/master | ||
# These files are not in the public prebid.js repo, so they aren't included by the 'openx*' below | ||
git checkout openx/master modules/openxRtbBidAdapter.js | ||
git checkout openx/master test/spec/modules/openxRtbBidAdapter_spec.js | ||
# Copy files from openx/master -> release branch. | ||
# We copy files from the openx/master branch instead of rebasing to avoid merge conflicts. | ||
git checkout openx/master modules/openx* | ||
git checkout openx/master test/spec/modules/openx* | ||
git commit --allow-empty -m "Copied files from openx/master" | ||
git tag openx/$VERSION-1 | ||
git push origin HEAD --tags |