diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 13e8818..040cf5f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/publishManual.yml b/.github/workflows/publishManual.yml index e393354..3dac8fd 100644 --- a/.github/workflows/publishManual.yml +++ b/.github/workflows/publishManual.yml @@ -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 @@ -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 diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 8850f40..6e7f835 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -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/github-tag-action@1.64.0 env: diff --git a/build.gradle.kts b/build.gradle.kts index 33e6429..e77357a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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) diff --git a/docker/docker-build-projector.sh b/docker/docker-build-projector.sh index 5fd9e61..d8d67c3 100755 --- a/docker/docker-build-projector.sh +++ b/docker/docker-build-projector.sh @@ -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 diff --git a/docker/helper/modelix-version.sh b/docker/helper/modelix-version.sh index d626205..a0def00 100755 --- a/docker/helper/modelix-version.sh +++ b/docker/helper/modelix-version.sh @@ -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