Merge pull request #102 from HHS/dev #14
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
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: GCM Taskit Release Build | |
on: | |
push: | |
paths-ignore: | |
- 'README.md' | |
- 'LICENSE' | |
branches: ["main"] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
outputs: | |
gcm_taskit_version: ${{ steps.version-string.outputs.gcm_taskit_version }} | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout GCM Taskit | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
server-id: central | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Build GCM Taskit | |
run: mvn clean deploy -Pjavadoc,sign --file pom.xml | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SECRET_KEY_PASSWORD }} | |
- name: Get Version | |
id: version-string | |
run: | | |
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_ENV" | |
echo "gcm_taskit_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_OUTPUT" | |
- name: Make Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "protobuf/target/protobuf-${{ env.version }}*" | |
name: "v${{ env.version }}" | |
tag: "v${{ env.version }}" | |
generateReleaseNotes: true | |
skipIfReleaseExists: true | |
update-gcm-pipeline: | |
if: ${{ !endsWith(needs.release.outputs.gcm_taskit_version, '0') }} | |
needs: release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
VERSION: ${{ needs.release.outputs.gcm_taskit_version }} | |
steps: | |
- name: Checkout GCM Pipeline | |
uses: actions/checkout@v4 | |
with: | |
repository: HHS/ASPR-ms-gcm-pipeline | |
token: ${{ secrets.GHA_BOT }} | |
- name: Update GCM Taskit version | |
run : | | |
echo "$VERSION" | |
sed -i "0,/<gcm-taskit.version>.*<\/gcm-taskit.version>/s//<gcm-taskit.version>$VERSION<\/gcm-taskit.version>/g" pom.xml | |
- name: Increment GCM Pipeline Version | |
run: | | |
current_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml) | |
echo GCM Pipeline Version: $current_version | |
parts=( ${current_version//./ } ) | |
bv=$((parts[2] + 1)) | |
new_version="${parts[0]}.${parts[1]}.${bv}" | |
echo New GCM Pipeline Version: $new_version | |
sed -i "0,/<revision>.*<\/revision>/s//<revision>$new_version<\/revision>/g" pom.xml | |
- name: Setup Git | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- name: Make branch in GCM Pipeline | |
run: | | |
git checkout -b update-gcm-taskit-to-$VERSION | |
git add pom.xml | |
git commit -m "Update gcm taskit to $VERSION" | |
git push --set-upstream origin update-gcm-taskit-to-$VERSION | |
- name: Make PR in GCM Pipeline | |
run: | | |
gh pr create -R HHS/ASPR-ms-gcm-pipeline -B main --fill | |
gh pr merge -m --auto | |
env: | |
GH_TOKEN: ${{ secrets.GHA_BOT }} |