Skip to content

trigger auto tag on PR edit and merge #18

trigger auto tag on PR edit and merge

trigger auto tag on PR edit and merge #18

Workflow file for this run

name: CI_package
on:
pull_request:
branches:
- main
push:
tags:
- '*'
jobs:
tag-version:
if: github.event_name == 'pull_request'
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
- name: tag ${{ github.head_ref }}
run: |
# date > generated.txt
# Note: the following account information will not work on GHES
git tag $(git rev-parse --abbrev-ref HEAD)_tag_$(git rev-parse --short HEAD)
git push --tags
lux-package:
# if: github.event_name == 'push'
if: ${{ always() }}
needs: tag-version
runs-on: ubuntu-latest
env:
TAG: ${{ github.event_name == 'push' && github.ref || format('{0}_tag_{1]', github.head_ref, $GITHUB_SHA) }}

Check failure on line 33 in .github/workflows/ci_bundle.yml

View workflow run for this annotation

GitHub Actions / CI_package

Invalid workflow file

The workflow is not valid. .github/workflows/ci_bundle.yml (Line: 33, Col: 12): Unexpected symbol: '$GITHUB_SHA'. Located at position 85 within expression: github.event_name == 'push' && github.ref || format('{0}_tag_{1]', github.head_ref, $GITHUB_SHA) .github/workflows/ci_bundle.yml (Line: 54, Col: 21): Unexpected end of expression: '||'. Located at position 43 within expression: github.event_name == 'push' && github.ref ||
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: compute tag name
run: echo "AUTO_TAG=$(git rev-parse --abbrev-ref HEAD)_tag_$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: check tag name
run: |
echo ${{ env.AUTO_TAG }}
echo ${{ env.TAG }}
- name: create release
id: create_release
uses: octokit/request-action@v2.x
with:
# secrets.GITHUB_TOKEN is a secret only valid for one CI execution
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
route: POST /repos/{owner}/{repo}/releases
owner: 'Geoportail-Luxembourg'
repo: 'luxembourg-geoportail'
tag_name: ${{ github.event_name == 'push' && github.ref || }}
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Build and pack prod library
shell: bash
run: |
npm ci
npm run build:lib:prod
npm pack
- name: upload manually
run: |
project_name=$(npm run env | grep "npm_package_name" | sed s/npm_package_name=//)
pkg_name=$(ls $project_name-*)
lib_name=$(echo $pkg_name | sed s/luxembourg-geoportail-/luxembourg-geoportail-lib-/)
curl -X POST "https://uploads.github.com/repos/$owner/$repo/releases/$id/assets?name=$lib_name" --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/octet-stream" --data-binary "@$pkg_name"
env:
owner: 'Geoportail-Luxembourg'
repo: 'luxembourg-geoportail'
id: ${{ fromJSON(steps.create_release.outputs.data).id }}