Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Release trigger action - second approach (#1011)
Browse files Browse the repository at this point in the history
* ♻️ Use `gh` CLI to trigger workflow

Use `gh` CLI to trigger workflow rather than relying on `push:tags` trigger, which doesn't work.

* πŸ”– Bump version
  • Loading branch information
trymzet authored Aug 26, 2024
1 parent 781d88e commit 0b77e59
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Release

on:
push:
tags:
- "v2.*.*" # Match tags that begin with "v2".
workflow_dispatch:
inputs:
version:
description: "The release version."
required: true
default: "v2.x.x"

jobs:
build-distribution:
Expand Down Expand Up @@ -56,6 +59,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 2.0

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -75,7 +79,7 @@ jobs:
- name: Construct the tag for Docker images
run: |
# Strip the "v" prefix for the image tag.
VERSION=${{ github.ref_name }}
VERSION=${{ github.event.inputs.version }}
echo "TAG=${VERSION#v}" >> $GITHUB_ENV
- name: Build and publish viadot-lite image
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/detect-and-tag-new-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ jobs:
with:
tag: v${{ steps.get-version.outputs.version }}

- name: Set up git user
# Note: we cannot use the default user here or things like fregante/setup-git-user@v1
# because this will magically not trigger the cd.yml workflow (it turns out the on:push:tags
# trigger does not work for tags pushed using the GitHub Actions bot's token).
run: |
git config --global user.email "[email protected]"
git config --global user.name "Ludovico Bot"
- uses: fregante/setup-git-user@v2
if: steps.check-tag.outputs.exists != 'true'

- name: Publish the new tag
# Trigger the cd.yml workflow if a new tag is detected.
id: publish-tag
if: steps.check-tag.outputs.exists != 'true'
env:
GH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
run: |
git tag -a v${{ steps.get-version.outputs.version }} -m "Release v${{ steps.get-version.outputs.version }}"
git push origin v${{ steps.get-version.outputs.version }}
- name: Run the release workflow
if: steps.check-tag.outputs.exists != 'true'
env:
GH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
run: gh workflow run cd.yml -f version=${{ steps.get-version.outputs.version }} --ref 2.0
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "viadot2"
version = "2.1.10"
version = "2.1.11"
description = "A simple data ingestion library to guide data flows from some places to other places."
authors = [
{ name = "acivitillo", email = "[email protected]" },
Expand Down

0 comments on commit 0b77e59

Please sign in to comment.