Fix missing sha file #27
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
name: push rc test | |
on: | |
push: | |
branches: | |
- fix-bugs | |
jobs: | |
# check for changed packages | |
verify-packages: | |
name: Verify changed packages | |
permissions: | |
id-token: write | |
contents: write | |
actions: read | |
runs-on: ubuntu-22.04 | |
outputs: | |
changed_packages: ${{ steps.tag_check_changes.outputs.changed_packages }} | |
latest_tag: ${{ steps.tag_check_changes.outputs.latest_tag }} | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Prepare pre-requisites | |
uses: ./.github/actions/prepare | |
- name: Install deps | |
run: yarn install-deps | |
- name: Style | |
run: yarn style | |
- name: Build | |
run: yarn nx-build-skip-cache | |
- name: Test | |
run: yarn nx-test-skip-cache | |
- name: Get latest git tag and verify package changes | |
id: tag_check_changes | |
run: | | |
git fetch --prune --unshallow --tags | |
latest_tag=$(git describe --tags --abbrev=0 --match "v*") | |
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT | |
changed_packages=$(lerna changed --json | jq -r 'length') | |
echo "changed_packages=${changed_packages:-0}" >> $GITHUB_OUTPUT | |
# Commit & Push to branch | |
commit-push: | |
name: Commit and push changes | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
needs: verify-packages | |
runs-on: ubuntu-22.04 | |
outputs: | |
sha: ${{ steps.get_sha.outputs.sha }} | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Use node@16 | |
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 | |
with: | |
node-version: 16.20.0 | |
- name: Update RC candidate version ( excluding deploy client ) | |
run: | | |
if [[ ${{ needs.verify-packages.outputs.latest_tag }} != *"rc"* ]]; then | |
yarn versionup:preminor && ./hack/cross-dependency.sh | |
else | |
yarn versionup:prerelease && ./hack/cross-dependency.sh | |
fi | |
- name: get latest version | |
id: update_version | |
run: | | |
TAG_NAME=$(node -p "require('./lerna.json').version") | |
echo "rc_version=v$TAG_NAME" >> $GITHUB_OUTPUT | |
- name: Verify version | |
id: verify_version | |
run: | | |
CURRENT_VERSION=$(echo "${{ needs.verify-packages.outputs.latest_tag }}" | sed 's/^v//') | |
NEW_VERSION=$(echo "${{ steps.update_version.outputs.rc_version }}" | sed 's/^v//') | |
CURRENT_MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2) | |
NEW_MINOR=$(echo "$NEW_VERSION" | cut -d. -f2) | |
if (( NEW_MINOR != CURRENT_MINOR + 1 )); then | |
echo "New version is not one minor version ahead of the current version" | |
exit 1 | |
fi | |
# Commit all changed files back to the repository | |
- name: commit to the branch | |
id: commit | |
uses: planetscale/ghcommit-action@6ca6b06e9d2de1296143831c53e1d601831ba2a2 | |
with: | |
commit_message: "🤖 Update version to ${{ steps.update_version.outputs.rc_version }}" | |
repo: ${{ github.repository }} | |
branch: ${{ github.head_ref || github.ref_name }} | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
# checkout to get the latest commit sha | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get commit SHA | |
id: get_sha | |
run: | | |
git stash | |
git pull origin ${{ github.head_ref || github.ref_name }} | |
SHA=$(git rev-parse HEAD) | |
echo "sha=$SHA" >> $GITHUB_OUTPUT | |
echo $SHA > sha.txt | |
AUTHOR=$(git show -s --format='%an' $(git rev-parse HEAD)) | |
echo "author=$AUTHOR" >> $GITHUB_OUTPUT | |
- name: Upload SHA as artifact | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 | |
with: | |
name: sha | |
path: sha.txt | |
retention-days: 1 | |
publish-tag: | |
name: Publish & Tag | |
needs: commit-push | |
uses: ./.github/workflows/rc-publish-test.yml | |
secrets: inherit |