Skip to content

Commit

Permalink
fixes GITHUB_ env
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelbruno committed May 21, 2023
1 parent b54fab5 commit 38bf546
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ and container images. The build itself can also be done in a container.
### Configuration (Once)

The configuration is done with environment variables.
For GitHub : GITHUBORG (GitHub account or organisation), GITHUB_ACTOR, GITHUB_TOKEN
For GitHub : GITHUBORG (GitHub account or organisation), GITHUBACTOR, GITHUBTOKEN, GITHUBORG (org or account)
and optionally for SonarQube SONAR_URL and SONAR_TOKEN (To install SonarQube see https://github.com/ebpro/sonarqube)

For GitHub the CLI is needed (https://cli.github.com/).
Expand All @@ -99,7 +99,7 @@ Those variables have to be stored on the CI server (see [GitHub Encrypted secret
The script below transforms the local variables in GitHub secrets.

```bash
bash -c 'for secret in GITHUB_ACTOR GITHUB_TOKEN SONAR_URL SONAR_TOKEN; do \
bash -c 'for secret in GITHUBACTOR GITHUBTOKEN SONAR_URL SONAR_TOKEN; do \
eval gh secret set $secret --app actions \
--body ${!secret} \
--org ${GITHUBORG} \
Expand All @@ -124,7 +124,7 @@ Generate each new project with this maven archetype (adapt at least the bold par
mvn --batch-mode archetype:generate \
-DarchetypeGroupId=fr.ebruno.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-withparent \
-DgithubAccount=<b>$GITHUB_ORG</b> \
-DgithubAccount=<b>$GITHUBORG</b> \
-DgroupId=<b>demo.pkg</b> \
-DartifactId=<b>MyApp</b> \
-Dversion=0.1.0-SNAPSHOT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Java CI
on: [ push ]

env:
GITHUBLOGIN: ${{secrets.GITHUBLOGIN}}
GITHUBACTOR: ${{secrets.GITHUBACTOR}}
GITHUBTOKEN: ${{secrets.GITHUBTOKEN}}
SONAR_URL: ${{secrets.SONAR_URL}}
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ FROM maven:3.8-eclipse-temurin-17-focal AS ubuntubuild
# We get important parameters as build-args
# and we transfer them as env variable (for maven settings substitution) with ENV.
# WARNING NEVER IN THE LAST STAGE
ARG GITHUB_LOGIN
ARG GITHUB_TOKEN
ARG GITHUBLOGIN
ARG GITHUBTOKEN
ARG SONAR_URL
ARG SONAR_TOKEN
ARG DOCKER_LOGIN
ARG DOCKER_TOKEN
ARG IMAGE_NAME
ENV GITHUB_LOGIN="$GITHUB_LOGIN"
ENV GITHUB_TOKEN="$GITHUB_TOKEN"
ENV GITHUBLOGIN="$GITHUBLOGIN"
ENV GITHUBTOKEN="$GITHUBTOKEN"
ENV SONAR_URL="$SONAR_URL"
ENV SONAR_TOKEN="$SONAR_TOKEN"
ENV DOCKER_LOGIN="$DOCKER_LOGIN"
Expand Down Expand Up @@ -52,15 +52,15 @@ ENTRYPOINT /${IMAGE_NAME}/bin/myapp

########## JLINK FROM ALPINE (needed for the right JRE binary) to ALPINE ##########
FROM maven:3.8.6-eclipse-temurin-17-alpine AS jlinkAlpineBuild
ARG GITHUB_LOGIN
ARG GITHUB_TOKEN
ARG GITHUBLOGIN
ARG GITHUBTOKEN
ARG SONAR_URL
ARG SONAR_TOKEN
ARG DOCKER_LOGIN
ARG DOCKER_TOKEN
ARG IMAGE_NAME
ENV GITHUB_LOGIN="$GITHUB_LOGIN"
ENV GITHUB_TOKEN="$GITHUB_TOKEN"
ENV GITHUBLOGIN="$GITHUBLOGIN"
ENV GITHUBTOKEN="$GITHUBTOKEN"
ENV SONAR_URL="$SONAR_URL"
ENV SONAR_TOKEN="$SONAR_TOKEN"
ENV DOCKER_LOGIN="$DOCKER_LOGIN"
Expand All @@ -84,15 +84,15 @@ ARG JAVA_VERSION="22.3.r17-grl"
ARG MAVEN_VERSION="3.8.6"
ENV SDKMAN_DIR=/root/.sdkman

ARG GITHUB_LOGIN
ARG GITHUB_TOKEN
ARG GITHUBLOGIN
ARG GITHUBTOKEN
ARG SONAR_URL
ARG SONAR_TOKEN
ARG DOCKER_LOGIN
ARG DOCKER_TOKEN
ARG IMAGE_NAME
ENV GITHUB_LOGIN="$GITHUB_LOGIN"
ENV GITHUB_TOKEN="$GITHUB_TOKEN"
ENV GITHUBLOGIN="$GITHUBLOGIN"
ENV GITHUBTOKEN="$GITHUBTOKEN"
ENV SONAR_URL="$SONAR_URL"
ENV SONAR_TOKEN="$SONAR_TOKEN"
ENV DOCKER_LOGIN="$DOCKER_LOGIN"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<servers>
<server>
<id>github</id>
<username>${env.GITHUB_ACTOR}</username>
<password>${env.GITHUB_TOKEN}</password>
<username>${env.GITHUBACTOR}</username>
<password>${env.GITHUBTOKEN}</password>
</server>
<server>
<id>gpg.passphrase</id>
Expand Down

0 comments on commit 38bf546

Please sign in to comment.