Fix adding CDx biomarker association (#450) #44
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: After branch commit | |
on: | |
push: | |
branches: | |
- master | |
- rc | |
jobs: | |
check-version-level-and-update: | |
if: github.repository == 'oncokb/oncokb-transcript' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: 'Update Version Level' | |
run: | | |
git pull | |
VERSION_LEVEL=$(cat .version-level | tr "[:upper:]" "[:lower:]") | |
RELEASE_DRAFTER_MINOR='NEXT_MINOR_VERSION' | |
RELEASE_DRAFTER_PATCH='NEXT_PATCH_VERSION' | |
if [[ $VERSION_LEVEL == 'minor' ]]; then | |
sed -i "s/$RELEASE_DRAFTER_PATCH/$RELEASE_DRAFTER_MINOR/gi" .github/release-drafter.yml | |
fi | |
if [[ $VERSION_LEVEL == 'patch' ]]; then | |
sed -i "s/$RELEASE_DRAFTER_MINOR/$RELEASE_DRAFTER_PATCH/gi" .github/release-drafter.yml | |
fi | |
CHANGED=$(git diff --name-only HEAD --) | |
if [ -n "$CHANGED" ] | |
then | |
git config user.name oncokb-bot | |
git config user.email dev.oncokb@gmail.com | |
git add . | |
git commit -m "Update action files to align the version level to $VERSION_LEVEL" | |
git push | |
fi | |
update-draft-release: | |
needs: [check-version-level-and-update] | |
if: github.repository == 'oncokb/oncokb-transcript' | |
runs-on: ubuntu-latest | |
steps: | |
# Drafts your next Release notes as Pull Requests are merged into "master" | |
- uses: release-drafter/release-drafter@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
update-pom: | |
needs: [check-version-level-and-update] | |
if: github.repository == 'oncokb/oncokb-transcript' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Extract branch name | |
id: extract_branch | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
- name: Find previous release | |
id: find_release | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const branch = '${{ steps.extract_branch.outputs.branch }}'; | |
console.log('Looking for a latest release that is based on branch: ${{ steps.extract_branch.outputs.branch }}'); | |
const releases = await github.rest.repos.listReleases({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}); | |
const release = releases.data.find(r => (r.target_commitish === branch || r.target_commitish === `refs/heads/${branch}`) && !r.draft); | |
if (release) { | |
core.setOutput('tag', release.tag_name); | |
} else { | |
core.setFailed("No tag available, fail the action."); | |
} | |
- name: 'Get next semantic versions' | |
id: semvers | |
uses: "WyriHaximus/github-action-next-semvers@v1" | |
with: | |
version: ${{ steps.find_release.outputs.tag }} | |
- name: 'Setup Java' | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 8 | |
- name: 'Get Current Version Level' | |
id: version_level | |
run: | | |
VERSION_LEVEL=$(cat .version-level | tr "[:upper:]" "[:lower:]") | |
echo "::set-output name=VERSION_LEVEL::$VERSION_LEVEL" | |
- name: 'Update Pom' | |
if: ${{ success() }} | |
env: | |
NEW_VERSION: ${{ steps.version_level.outputs.VERSION_LEVEL == 'minor' && steps.semvers.outputs.minor || steps.semvers.outputs.patch}} | |
run: | | |
echo "${NEW_VERSION}" | |
git pull | |
mvn --batch-mode versions:set -DnewVersion=${NEW_VERSION} -DgenerateBackupPoms=false | |
CHANGED=$(git diff --name-only HEAD --) | |
if [ -n "$CHANGED" ] | |
then | |
git config user.name oncokb-bot | |
git config user.email dev.oncokb@gmail.com | |
git add . | |
git commit -m 'Update pom version' | |
git push | |
fi |