Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
Fix bugs in publish pipeline (#55)
Browse files Browse the repository at this point in the history
There was a bug in the publishing pipeline which would release wrongly
versioned (docker) artifacts. This PR fixes these bugs and increases
verbosity to allow easier analysis in case of errors or bugs.
  • Loading branch information
nkoester authored Sep 6, 2023
2 parents a8756b7 + b47a25b commit c594b1c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 8 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: "${{ github.ref_name }}"

- name: Set up JDK 11
uses: actions/setup-java@v2
Expand All @@ -25,10 +27,16 @@ jobs:
java-version: '11'

- name: Use tag name as version
run: echo "${GITHUB_REF#refs/*/}" > modelix.version
run: |
set -x
echo "${GITHUB_REF#refs/*/}" > modelix.version
- name: Build and Publish Maven
run: ./gradlew assemble publish -Partifacts.itemis.cloud.user=${{secrets.ARTIFACTS_ITEMIS_CLOUD_USER}} -Partifacts.itemis.cloud.pw=${{secrets.ARTIFACTS_ITEMIS_CLOUD_PW}} -Pgpr.user=${{ github.actor }} -Pgpr.key=${{ secrets.GHP_UNIVERSAL_PUBLISH_TOKEN }}
run: |
./gradlew assemble publish -Partifacts.itemis.cloud.user=${{secrets.ARTIFACTS_ITEMIS_CLOUD_USER}} \
-Partifacts.itemis.cloud.pw=${{secrets.ARTIFACTS_ITEMIS_CLOUD_PW}} \
-Pgpr.user=${{ github.actor }} \
-Pgpr.key=${{ secrets.GHP_UNIVERSAL_PUBLISH_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -42,4 +50,6 @@ jobs:
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
DOCKER_HUB_KEY: ${{ secrets.DOCKER_HUB_KEY }}
run: cd docker && ./docker-build-projector.sh
run: |
cd docker
./docker-build-projector.sh
15 changes: 11 additions & 4 deletions .github/workflows/publishManual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ jobs:
java-version: '11'

- name: Use tag name as version
run: echo "${{ inputs.TAG_TO_RELEASE }}" > modelix.version
run: |
set -x
echo "${{ inputs.TAG_TO_RELEASE }}" > modelix.version
- name: Build and Publish Maven
env:
run: ./gradlew assemble publish -Partifacts.itemis.cloud.user=${{secrets.ARTIFACTS_ITEMIS_CLOUD_USER}} -Partifacts.itemis.cloud.pw=${{secrets.ARTIFACTS_ITEMIS_CLOUD_PW}} -Pgpr.user=${{ github.actor }} -Pgpr.key=${{ secrets.GHP_UNIVERSAL_PUBLISH_TOKEN }}
run: |
./gradlew assemble publish -Partifacts.itemis.cloud.user=${{secrets.ARTIFACTS_ITEMIS_CLOUD_USER}} \
-Partifacts.itemis.cloud.pw=${{secrets.ARTIFACTS_ITEMIS_CLOUD_PW}} \
-Pgpr.user=${{ github.actor }} \
-Pgpr.key=${{ secrets.GHP_UNIVERSAL_PUBLISH_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -43,4 +48,6 @@ jobs:
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
DOCKER_HUB_KEY: ${{ secrets.DOCKER_HUB_KEY }}
run: cd docker && ./docker-build-projector.sh
run: |
cd docker
./docker-build-projector.sh
2 changes: 2 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
nextVersion=$((lastVersion+1))
echo "nextVersion=$nextVersion" >> $GITHUB_ENV
- name: Switch to branch mps/2020.3
run: git switch mps/2020.3
- name: Tag 2020.3 with new version
uses: anothrNick/[email protected]
env:
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fun getAndWriteModelixVersion(): String {
modelixVersion = if (versionFile.exists()) {
versionFile.readText().trim()
} else {
println("No version file exits, generating SNAPSHOT version")
"${mpsCatalog.versions.mpsbase.asProvider().get()}-" + SimpleDateFormat("yyyyMMddHHmm").format(java.util.Date()) + "-SNAPSHOT"
}
versionFile.writeText(modelixVersion)
Expand Down
4 changes: 4 additions & 0 deletions docker/docker-build-projector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ cp -r ../build/org.modelix/build/artifacts/org.modelix build/artifacts/
MPS_VERSION=$( ./helper/mps-version.sh )
MODELIX_VERSION=$( ./helper/modelix-version.sh )

echo "Will use the following versions:"
echo " MPS_VERSION: ${MPS_VERSION}"
echo " MODELIX_VERSION: ${MODELIX_VERSION}"

docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_KEY"

if [ "${CI}" = "true" ]; then
Expand Down
3 changes: 2 additions & 1 deletion docker/helper/modelix-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ set -e
MPS_VERSION=$( ./helper/mps-version.sh )
VERSION_FILE="../modelix.version"

if [ -f "VERSION_FILE" ]; then
if [ -f "${VERSION_FILE}" ]; then
MODELIX_VERSION=$(cat ${VERSION_FILE})
else
echo "Unable to find modelix.version in root - will generate SNAPSHOT version"
MODELIX_VERSION="${MPS_VERSION}-$(date +"%Y%m%d%H%M")-SNAPSHOT"
echo "$MODELIX_VERSION" > ${VERSION_FILE}
fi
Expand Down

0 comments on commit c594b1c

Please sign in to comment.