Skip to content

Update package.json. #21

Update package.json.

Update package.json. #21

Workflow file for this run

name: Release
on:
push:
branches:
- main
- dev
#on:
# workflow_call:
# inputs:
# tag:
# required: true
# type: string
jobs:
release:
runs-on: ubuntu-22.04
name: Release
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Compose Release Tag
id: release_tag
run: |
if [[ ${{ github.event_name }} == "pull_request" ]]; then
SHA=${{ github.event.pull_request.head.sha }}
else
SHA=$(echo "$GITHUB_CONTEXT" | jq '.event.commits[].id' | tail -2 | head -1 | sed 's/\"//g')
fi
DATE=$(git show -s --format=%ad --date=format:'%Y-%m-%d' $SHA)
TAG=dev-$DATE-${SHA::8}
echo "SHA: $SHA"
echo "TAG: $TAG"
echo "TAG=$TAG" >> $GITHUB_OUTPUT
echo "SHA=$SHA" >> $GITHUB_OUTPUT
# - name: login
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
- name: Test release
id: test_release
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git checokut -b dev-nightly
git add .
git commit -m "generated"
git push origin dev-nightly
- name: Release
id: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
REPO=$(echo "$GITHUB_CONTEXT" | jq -r '.repository')
TAG=${{ steps.release_tag.outputs.TAG }}
SHA=${{ steps.release_tag.outputs.SHA }}
# git tag -a ${{ steps.release_tag.outputs.TAG }}
# git push --follow-tags
gh api repos/$REPO/git/refs -f ref="refs/tags/$TAG" -f sha="$SHA"
# gh release create ${{ steps.release_tag.outputs.TAG }} --repo "$REPO" --title "some title" --generate-notes