Skip to content

fix: add GITHUB_TOKEN to env variables #1

fix: add GITHUB_TOKEN to env variables

fix: add GITHUB_TOKEN to env variables #1

name: Maven Snapshot
on:
workflow_call:
inputs:
JAVA_VERSION:
required: false
type: string
default: '21'
description: 'Java version to use for build'
MAVEN_REPO_SERVER_ID:
required: true
type: string
description: 'Server ID in Maven settings.xml'
secrets:
VAULT_ADDR:
required: true
CI_SECRET_READER_PERIODIC_TOKEN:
required: true
VAULTCA:
required: true
SLACK_WEBHOOK_URL:
required: true
GITHUB_TOKEN:

Check failure on line 24 in .github/workflows/maven-snapshot.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/maven-snapshot.yml

Invalid workflow file

secret name `GITHUB_TOKEN` within `workflow_call` can not be used since it would collide with system reserved name
required: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: ${{ secrets.GITHUB_TOKEN }}
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.JAVA_VERSION }}
distribution: 'temurin'
cache: maven
- name: Fetch Vault Secrets
uses: hashicorp/vault-action@v3
with:
url: ${{ secrets.VAULT_ADDR }}
token: ${{ secrets.CI_SECRET_READER_PERIODIC_TOKEN }}
caCertificate: ${{ secrets.VAULTCA }}
secrets: |
ci/data/gh-workflows/maven-danubetech-nexus username | MAVEN_USERNAME ;
ci/data/gh-workflows/maven-danubetech-nexus password | MAVEN_PASSWORD
- name: Configure Maven Settings
run: |
mkdir -p ~/.m2
cat > ~/.m2/settings.xml << EOF
<settings>
<servers>
<server>
<id>${{ inputs.MAVEN_REPO_SERVER_ID }}</id>
<username>${{ env.MAVEN_USERNAME }}</username>
<password>${{ env.MAVEN_PASSWORD }}</password>
</server>
</servers>
</settings>
EOF
- name: Build and Deploy with Maven
run: mvn --batch-mode -U deploy
- name: Slack notification
if: failure()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,commit,action,eventName,ref,workflow
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}