aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/tag-repos.yml
blob: 0e5de76a578f6b540de3b41a862f5476911f87db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Tag all repos

on:
  release:
    types: [published]
  # Manual trigger from the UI
  workflow_dispatch:

jobs:
  tag-repos:
    runs-on: macos-12
    steps:
      - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'release'
        uses: actions/checkout@v4
        if: ${{ contains(github.event.release.tag_name, 'nightly') || (github.event_name == 'workflow_dispatch') }}
        with:
          ref: nightly
          submodules: recursive
          fetch-depth: 0 # Note: Needed to be able to pull the 'develop' branch as well for merging
      - name: Checkout code along with submodules for the 'release' branch if the trigger event is 'release'
        uses: actions/checkout@v4
        if: ${{ !contains(github.event.release.tag_name, 'nightly') }}
        with:
          ref: release
          submodules: recursive
          fetch-depth: 0 # Note: Needed to be able to pull the 'develop' branch as well for merging
      - name: Extract Git tag name from the currently checked out branch (not from the branch where this run was kicked off)
        run: |
          TAG_NAME=$(node -p 'require("./package.json").version')
          echo "TAG_NAME=v$TAG_NAME" >> $GITHUB_ENV
        shell: bash
    # Note: commented out the tagging of the main repo - since that is auto-created when a new release is published
    # - name: Tag the main repo
    #   run: |
    #     git tag -f $TAG_NAME
    #     git push origin --tags --no-verify
    #   shell: bash
    # Also tag the submodule so as to help identify which changes went into which release
    # TODO: Not working due to cross-repo access issues by the github-action bot
    # - name: Tag the submodule
    #   env:
    #     GH_TOKEN: ${{ secrets.FERDIUM_RECIPES_PUBLISH_TOKEN }}
    #   run: |
    #     git -C recipes tag -f $TAG_NAME
    #     git -C recipes push origin --tags --no-verify
    #   shell: bash