diff --git a/.github/workflows/ci_bundle.yml b/.github/workflows/ci_bundle.yml index d8e24243..786ff32d 100644 --- a/.github/workflows/ci_bundle.yml +++ b/.github/workflows/ci_bundle.yml @@ -1,28 +1,31 @@ name: CI_package on: - pull_request: - types: - - closed - branches: - - main push: + branches: + - 'main' tags: - '*' jobs: tag-version: - if: github.event_name == 'pull_request' + if: github.ref_type != 'tag' runs-on: ubuntu-latest steps: - name: checkout ${{ github.head_ref }} uses: actions/checkout@v4 with: - ref: ${{ github.head_ref }} - fetch-depth: 0 - - run: git status - - run: git rev-parse --abbrev-ref HEAD + # default depth is 1, but we need the parent refs + fetch-depth: 2 + - name: compute tag name + shell: bash + run: | + branch=$([[ $(git log --pretty="%p" -n 1 | wc -w) -gt 1 ]] \ + && echo $(git log -n 1 --pretty="%s" | sed "s|.*Geoportail-Luxembourg/\(.*\)|\1|") \ + || git branch --show-current) + echo $branch + echo "AUTO_TAG=${branch}_CI_$(git log -n 1 --pretty=%h)" >> $GITHUB_ENV - name: tag ${{ github.head_ref }} run: | - git tag $(git rev-parse --abbrev-ref HEAD)_CI_$(git rev-parse --short HEAD) + git tag ${{ env.AUTO_TAG }} git push --tags lux-package: # the combination (if always) + (needs tag-version) makes sure the lux-package job runs