Skip to content

Commit

Permalink
Fine-tune workflow for tag generation on main branch pushes (#141)
Browse files Browse the repository at this point in the history
* output all test variables

* fix workflow

* fix workflow

* pretty print objects

* fix echo quoting

* fix quotes

* test tags

* clean workflow

* create auto tag on branch pushes instead of PR

* debug bash

* test mutli cmd run

* do use env variable

* cleanup

* verbose output

* fix echo

* fix bash

* another bash check

* unecho

* echo variants

* more echos

* checkout

* check git version

* deepen fetch to find parents

* cleanup

* set correct tag names and job activation conditions
  • Loading branch information
mki-c2c authored Aug 12, 2024
1 parent 8660204 commit 86d3c19
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/ci_bundle.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 86d3c19

Please sign in to comment.