Skip to content

Commit

Permalink
update ci 28
Browse files Browse the repository at this point in the history
  • Loading branch information
hirsch88 committed Feb 28, 2024
1 parent b11e83c commit 6d8ee87
Showing 1 changed file with 56 additions and 66 deletions.
122 changes: 56 additions & 66 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Get Action URL
id: action-url
run: echo "url=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_OUTPUT

- name: Create comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.comment.id }}
edit-mode: replace
body: |
**🚚 Snapshot Version in Progress..**
[Check out the release on GitHub β†—οΈŽ](${{ steps.action-url.outputs.url }})
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand All @@ -23,92 +37,68 @@ jobs:
with:
path: packages/core

# - name: Get current timestamp
# id: timestamp
# run: echo "timestamp=$(date +%Y%m%d%H%M%S)" >> $GITHUB_OUTPUT

# - name: Truncate timestamp to 8 characters
# id: truncated_timestamp
# run: echo "${{ steps.timestamp.outputs.timestamp}}"

- name: Get Last Commit SHA
id: last-commit
run: |
COMMITS_URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}/commits"
LAST_COMMIT_SHA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" $COMMITS_URL | jq -r '.[-1].sha')
echo "sha=$LAST_COMMIT_SHA" >> $GITHUB_OUTPUT
- name: Echo Sha Long
run: echo "${{ steps.last-commit.outputs.sha }}"

- name: Echo Sha Short
run: echo "$(git rev-parse --short ${{ steps.last-commit.outputs.sha }})"
- name: Shorten Commit Sha
id: short-sha
run: echo "value=$(git rev-parse --short ${{ steps.last-commit.outputs.sha }})" >> $GITHUB_OUTPUT

- name: set version
- name: Create version
id: set-version
run: echo "version=${{ steps.package-version.outputs.current-version}}-snapshot.${{ github.event.issue.number }}-${{github.event.pull_request.head.sha}}" >> $GITHUB_OUTPUT
run: echo "version=${{ steps.package-version.outputs.current-version}}-snapshot.${{ github.event.issue.number }}-${{ steps.short-sha.outputs.value }}" >> $GITHUB_OUTPUT

- name: Get Action URL
id: action-url
run: echo "url=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_OUTPUT

- name: Echo version
- name: Print version
run: echo "${{steps.set-version.outputs.version}}"

- uses: ./.github/workflows/actions/release-setup
with:
token: ${{ secrets.GITHUB_TOKEN }}
npm-token: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Define version
run: npx nx release version --git-commit=false --git-tag=false --preid=snapshot --specifier=${{steps.set-version.outputs.version}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: npx nx run-many -t build --projects=tag:scope:release

- name: Pre-Publish
run: npx nx run pre-publish

- name: Publish
run: npx nx release publish --tag=snapshot

- name: Create comment
if: success()
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.comment.id }}
edit-mode: replace
body: |
**🚚 Snapshot Version in Progress..**
**πŸš€ Snapshot Version Released!**
Version: `${{ steps.set-version.outputs.version }}`
[Check out the release on GitHub β†—οΈŽ](${{ steps.action-url.outputs.url }})
- name: Create comment
if: failure()
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.comment.id }}
edit-mode: replace
body: |
** πŸ’© Snapshot Version Failed!**
Version: `${{ steps.set-version.outputs.version }}`
[Check out the release on GitHub β†—οΈŽ](${{ steps.action-url.outputs.url }})
# - uses: ./.github/workflows/actions/release-setup
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# npm-token: ${{ secrets.NPM_PUBLISH_TOKEN }}

# - name: Define version
# run: npx nx release version --git-commit=false --git-tag=false --preid=snapshot --specifier=${{steps.set-version.outputs.version}}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: Build
# run: npx nx run-many -t build --projects=tag:scope:release

# - name: Pre-Publish
# run: npx nx run pre-publish

# - name: Publish
# run: npx nx release publish --tag=snapshot

# - name: Create comment
# if: success()
# uses: peter-evans/create-or-update-comment@v4
# with:
# comment-id: ${{ github.event.comment.id }}
# edit-mode: replace
# body: |
# ## πŸš€ Snapshot

# `${{ steps.set-version.outputs.version }}` is published!
# [Action](${{ steps.action-url.outputs.url }})

# - name: Create comment
# if: failure()
# uses: peter-evans/create-or-update-comment@v4
# with:
# comment-id: ${{ github.event.comment.id }}
# edit-mode: replace
# body: |
# ## πŸ’© Snapshot

# `${{ steps.set-version.outputs.version }}` has failed!
# [Action](${{ steps.action-url.outputs.url }})

# - name: Git Reset
# run: git reset --hard
- name: Git Reset
run: git reset --hard

0 comments on commit 6d8ee87

Please sign in to comment.