Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/auto-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
gh workflow run release.yml --ref "v${{ steps.version.outputs.version }}"
gh workflow run release.yml --ref "$GITHUB_REF_NAME" -f tag="v${{ steps.version.outputs.version }}"
24 changes: 16 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,22 @@ permissions:

on:
workflow_dispatch:
inputs:
tag:
description: Release tag to publish, for example v0.1.2
required: true
type: string
push:
tags:
- "v*.*.*"

concurrency:
group: release-${{ github.ref_name }}
group: release-${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
cancel-in-progress: false

env:
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}

jobs:
create-release:
runs-on: ubuntu-latest
Expand All @@ -22,18 +30,18 @@ jobs:
- name: Extract changelog
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME#v}"
VERSION="${RELEASE_TAG#v}"
awk "/^## \\[${VERSION}\\]/{found=1; next} /^## \\[/{if(found) exit} found{print}" CHANGELOG.md > release_notes.md
if [ ! -s release_notes.md ]; then
echo "Release ${GITHUB_REF_NAME}" > release_notes.md
echo "Release ${RELEASE_TAG}" > release_notes.md
fi

- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
gh release create "$RELEASE_TAG" \
--title "$RELEASE_TAG" \
--notes-file release_notes.md \
--verify-tag

Expand Down Expand Up @@ -84,7 +92,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
gh release upload "$GITHUB_REF_NAME" semrush-${{ matrix.target }}.* --clobber
gh release upload "$RELEASE_TAG" semrush-${{ matrix.target }}.* --clobber

homebrew:
needs: upload-assets
Expand All @@ -100,8 +108,8 @@ jobs:
exit 0
fi

VERSION="${GITHUB_REF_NAME#v}"
BASE_URL="https://github.com/osodevops/semrush-cli/releases/download/${GITHUB_REF_NAME}"
VERSION="${RELEASE_TAG#v}"
BASE_URL="https://github.com/osodevops/semrush-cli/releases/download/${RELEASE_TAG}"

curl -fsSL "${BASE_URL}/semrush-aarch64-apple-darwin.tar.gz" -o arm64.tar.gz
curl -fsSL "${BASE_URL}/semrush-x86_64-apple-darwin.tar.gz" -o x86_64_mac.tar.gz
Expand Down
Loading