fix: Adjust to new CLI commitID #193
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- develop | |
- patch/* | |
pull_request: | |
branches: | |
- develop | |
- patch/* | |
env: | |
MERGE_TO: main | |
PACKAGE_TYPE: node | |
GH_TOKEN: "${{ secrets.DEVOPS_GITHUB_TOKEN }}" | |
name: github release | |
jobs: | |
release-please: | |
outputs: | |
tag_name: ${{ steps.version.outputs.tag_name }} | |
sha: ${{ steps.version.outputs.sha }} | |
release_created: ${{ steps.version.outputs.release_created }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Please release | |
if: ${{ github.event.number == '' }} | |
uses: google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
release-type: ${{ env.PACKAGE_TYPE }} | |
default-branch: develop | |
- id: version | |
name: Detect final version info | |
run: | | |
if [ "${{ steps.release.outputs.release_created }}" != "true" ] | |
then | |
SHA="${{ github.sha }}" | |
RELEASE_CREATED="false" | |
# For the extension we cannot use - but must use . for the PR number. | |
DESCRIBE=$(git describe --tags --always) | |
echo "describe: $DESCRIBE" | |
OFFSET=$(echo $DESCRIBE | sed -n 's#.*-\([0-9]*\)-.*#\1#p') | |
if [ -n "$OFFSET" ] | |
then | |
OFFSET=".${OFFSET}" | |
fi | |
if [ -z "${{ github.event.number }}" ] | |
then | |
TAG_NAME="v$(node -pe 'require("./.release-please-manifest.json")["."]')${OFFSET}" | |
else | |
TAG_NAME="v$(node -pe 'require("./.release-please-manifest.json")["."]').10000.${{ github.event.number }}" | |
fi | |
echo "PR: ${{ github.event.number }}" | |
else | |
SHA="${{ steps.release.outputs.sha }}" | |
RELEASE_CREATED="true" | |
TAG_NAME="${{ steps.release.outputs.tag_name }}" | |
fi | |
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT | |
echo "sha=$SHA" >> $GITHUB_OUTPUT | |
echo "release_created=$RELEASE_CREATED" >> $GITHUB_OUTPUT | |
echo "Tag: $TAG_NAME" | |
echo "Sha: $SHA" | |
echo "Release: $RELEASE_CREATED" | |
artifacts-job: | |
needs: release-please | |
uses: ./.github/workflows/artifacts.yml | |
secrets: inherit | |
with: | |
sha: ${{ needs.release-please.outputs.sha }} | |
ref: ${{ github.ref }} | |
tag_name: ${{ needs.release-please.outputs.tag_name }} | |
release_created: ${{ needs.release-please.outputs.release_created }} | |
release: | |
needs: | |
- artifacts-job | |
- release-please | |
runs-on: ubuntu-latest | |
if: ${{ needs.release-please.outputs.release_created == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.release-please.sha }} | |
token: "${{ env.GH_TOKEN }}" | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: List | |
run: | | |
find artifacts -print | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
prerelease: true | |
body_path: CHANGELOG.md | |
token: ${{ env.GH_TOKEN }} | |
tag_name: ${{ needs.release-please.outputs.tag_name }} | |
files: | | |
artifacts/**/* | |
- name: Merge develop into ${{ env.MERGE_TO }} | |
uses: devmasx/merge-branch@master | |
if: ${{ endsWith(github.ref, '/develop') }} | |
with: | |
type: now | |
from_branch: develop | |
target_branch: "${{ env.MERGE_TO }}" | |
github_token: "${{ env.GH_TOKEN }}" | |
notify: | |
uses: ./.github/workflows/notify.yml | |
secrets: inherit | |
if: ${{ needs.release-please.outputs.release_created == 'true' }} | |
needs: | |
- release-please | |
- release | |
with: | |
sha: ${{ needs.release-please.outputs.sha }} | |
ref: ${{ github.ref }} | |
tag_name: ${{ needs.release-please.outputs.tag_name }} | |
release_created: ${{ needs.release-please.outputs.release_created }} |