Updated build token secrets to standards #25
Workflow file for this run
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://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: Java CI with Maven | |
permissions: | |
id-token: write | |
contents: write | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build_on_master: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache the Maven packages to speed up build | |
uses: actions/cache@v1 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Declare some variables | |
id: vars | |
shell: bash | |
run: | | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: maven | |
- name: Build with Maven | |
run: mvn -B -e -X clean install --file pom.xml -Drevision=${{ github.run_id }}.${{ steps.vars.outputs.sha_short }} | |
publish-job: | |
runs-on: ubuntu-latest | |
needs: [build_on_master] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: arn:aws:iam::329799773336:role/npiper-githubactions-role | |
aws-region: eu-west-2 | |
- name: Declare some variables | |
id: vars2 | |
shell: bash | |
run: | | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Git config user as github-actions bot for tagging | |
uses: snow-actions/[email protected] | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 14 | |
- run: mvn -e -B --file pom.xml -DskipTests site deploy scm:tag -Dgithub.global.userName=${{ secrets.GIT_USER_NAME}} -Dgithub.global.oauth2Token=${{ secrets.GIT_TOKEN}} -Drevision=${{ github.run_id }}.${{ steps.vars2.outputs.sha_short }} |