Skip to content

Commit

Permalink
Merge pull request #2811 from mapfish/fix-publish
Browse files Browse the repository at this point in the history
Fix publish
  • Loading branch information
sbrunner authored Feb 27, 2023
2 parents c55f432 + c1126b2 commit ea6e2d6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ jobs:
if: env.HAS_SECRETS == 'HAS_SECRETS'

- id: tag
run: echo "##[set-output name=tag;]$(echo ${{ github.ref }}|sed 's%refs/tags/%%g')"
run: echo "tag=$(echo ${{ github.ref }}|sed 's%refs/tags/%%g')" >> $GITHUB_OUTPUT
if: startsWith(github.ref, 'refs/tags/')
- run: sed --in-place 's/version=.*/version=${{ steps.tag.outputs.tag }}/g' gradle.properties
if: startsWith(github.ref, 'refs/tags/')

- id: last-tag
run: echo "##[set-output name=tag;]$(git describe --tags --abbrev=0)"
run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
if: "!startsWith(github.ref, 'refs/tags/')"
- id: no-tag
run: echo "##[set-output name=nb;]$(git log --oneline ${{ steps.last-tag.outputs.tag }}..HEAD|wc -l)"
run: echo "nb=$(git log --oneline ${{ steps.last-tag.outputs.tag }}..HEAD|wc -l)" >> $GITHUB_OUTPUT
if: "!startsWith(github.ref, 'refs/tags/')"
- run: sed --in-place 's/version=.*/version=${{ steps.last-tag.outputs.tag }}/g' gradle.properties
if: "!startsWith(github.ref, 'refs/tags/') && steps.no-tag.outputs.nb == 0"
Expand All @@ -63,7 +63,7 @@ jobs:
}}/g' gradle.properties
if: "!startsWith(github.ref, 'refs/tags/') && steps.no-tag.outputs.nb > 0"
- id: date
run: echo echo "##[set-output name=date;]$(date +%Y%m%d.%H%M%S)"
run: echo echo "date=$(date +%Y%m%d.%H%M%S)" >> $GITHUB_OUTPUT
if: github.ref == 'refs/heads/master'
- run: sed --in-place 's/version=.*/version=0.${{ steps.date.outputs.date }}.SNAPSHOT/g' gradle.properties
if: github.ref == 'refs/heads/master'
Expand All @@ -87,6 +87,8 @@ jobs:
if: always()
- run: docker cp builder:/src/core/build/ core/build/ || true
if: always()
- run: ls -l core/build/libs core/build/distributions
if: always()

- run: docker cp mapfish-print_tests_1:/src/examples/build/ examples/build/ || true
if: always()
Expand Down Expand Up @@ -135,13 +137,14 @@ jobs:
- name: Publish
run: c2cciutils-publish
if: env.HAS_SECRETS == 'HAS_SECRETS'
- run:
docker run --rm --env=GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} mapfish_print_builder bash -c 'gradle
build && gradle publish'
- run: >
docker run --rm --env=GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} mapfish_print_builder
bash -c 'gradle build && gradle publish'
if: ( startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' ) && env.HAS_SECRETS == 'HAS_SECRETS'
- id: version
run: echo "##[set-output name=version;]$(grep version gradle.properties|sed "s/ \+version=.\(.*\)./\1/g")"
run: echo "version=$(grep version gradle.properties|sed "s/version=\(.*\)/\1/g")" > $GITHUB_OUTPUT
- run: echo "${{ steps.version.outputs.version }}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/rebuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ jobs:
- run: gpg --export-secret-keys --armor D121AF2DFA8E140688BD968930C9B913FD42EF13 > CI.asc

- id: last-tag
run: echo "##[set-output name=tag;]$(git describe --tags --abbrev=0)"
run: echo "tag=$(git describe --tags --abbrev=0)" > $GITHUB_OUTPUT
- id: no-tag
run: echo "##[set-output name=nb;]$(git log --oneline ${{ steps.last-tag.outputs.tag }}..HEAD|wc -l)"
run: echo "nb=$(git log --oneline ${{ steps.last-tag.outputs.tag }}..HEAD|wc -l)" > $GITHUB_OUTPUT
- run: sed --in-place 's/version = .*/version = "${{ steps.last-tag.outputs.tag }}"/g' build.gradle
if: steps.no-tag.outputs.nb == 0
- run:
Expand Down Expand Up @@ -98,9 +98,9 @@ jobs:
- run: ./gradlew :core:libJavadocJar
if: startsWith(github.ref, 'refs/tags/')
- id: version
run: echo "##[set-output name=version;]$(grep version build.gradle|sed "s/ \+version = .\(.*\)./\1/g")"
run: echo "version=$(grep version build.gradle|sed "s/ \+version = .\(.*\)./\1/g")" > $GITHUB_OUTPUT
- id: tag
run: echo "##[set-output name=tag;]$(echo github.ref|sed 's%refs/tags/%%g')"
run: echo "tag=$(echo github.ref|sed 's%refs/tags/%%g')" > $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down

0 comments on commit ea6e2d6

Please sign in to comment.