Skip to content

Commit

Permalink
improve CI release
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeBu committed Apr 10, 2024
1 parent ba7d704 commit 6cfe0a5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
42 changes: 20 additions & 22 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ jobs:
needs:
- check_if_version_upgraded
if: needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true'
env:
TO_VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create tag
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git tag -a v${{ needs.check_if_version_upgraded.outputs.to_version }} -m "Deployment tag for v${{ needs.check_if_version_upgraded.outputs.to_version }}"
git tag -a v${{ env.TO_VERSION }} -m "Deployment tag for v${{ env.TO_VERSION }}"
git push --tags
Expand Down Expand Up @@ -175,12 +177,12 @@ jobs:
name: "Trigger production deploy"
runs-on: ubuntu-latest
environment: production
# concurrency:
# group: deploy-to-production
# cancel-in-progress: true
# needs:
# - docker
# - poke_gitops
concurrency:
group: deploy-to-production
cancel-in-progress: true
needs:
- docker
- poke_gitops
steps:
- run: echo "Triggering production deploy"
- name: Set up SSH
Expand Down Expand Up @@ -223,23 +225,19 @@ jobs:
const latestRelease = await github.request(`GET /repos/${{ github.repository }}/releases/latest`)
return latestRelease.data.tag_name
result-encoding: string
- name: Generate release notes content from latest release
id: generate-release-notes
uses: actions/github-script@v7
- name: "Generate release candidate on github"
uses: softprops/action-gh-release@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const releaseNotes = await github.request(`POST /repos/${{ github.repository }}/releases/generate-notes`, {
tag_name: `v${{ env.TO_VERSION }}`,
previous_tag_name: `${{steps.get-latest-release-tag.outputs.result}}` })
core.setOutput("name", releaseNotes.data.name);
core.setOutput("body", releaseNotes.data.body);
- name: Create release notes on github
name: Release v${{ env.TO_VERSION }}
prerelease: true
tag_name: v${{ env.TO_VERSION }}
target_commitish: ${{ steps.get-latest-release-tag.outputs.name }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete prerelease with same version
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.request(`POST /repos/${{ github.repository }}/releases`, {
tag_name: `v${{ env.TO_VERSION }}`,
name: `${{ steps.generate-release-notes.outputs.name }}`,
body: `${{ steps.generate-release-notes.outputs.body }}`})
await github.request(`DELETE /repos/${{ github.repository }}/releases/${v${{ env.TO_VERSION }}-rc}`)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sill",
"version": "1.42.14",
"version": "1.42.15",
"license": "MIT",
"private": true,
"scripts": {
Expand Down

0 comments on commit 6cfe0a5

Please sign in to comment.