Skip to content

Commit

Permalink
Update release script for test
Browse files Browse the repository at this point in the history
  • Loading branch information
sambles committed Sep 12, 2024
1 parent 58a4dff commit c0265b1
Showing 1 changed file with 72 additions and 45 deletions.
117 changes: 72 additions & 45 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ jobs:


steps:
- name: is branch valid for release
if: ${{ !startsWith(github.ref_name , 'release/') }}
run: |
echo "Releases must be trigged on branch named 'release/x.x.x'"
exit 1
- name: Check tag is valid for release
if: env.PRE_RELEASE == 'false'
run: |
VALID=$(echo ${{ env.RELEASE_TAG }} | grep -oPc "^(\d+)\.(\d+)\.(\d+)$")
if [[ ! "$VALID" == 1 ]]; then
echo "Release Tag ${{ env.RELEASE_TAG }} is not valid"
exit 1
fi
#- name: is branch valid for release
# if: ${{ !startsWith(github.ref_name , 'release/') }}
# run: |
# echo "Releases must be trigged on branch named 'release/x.x.x'"
# exit 1

#- name: Check tag is valid for release
# if: env.PRE_RELEASE == 'false'
# run: |
# VALID=$(echo ${{ env.RELEASE_TAG }} | grep -oPc "^(\d+)\.(\d+)\.(\d+)$")
# if [[ ! "$VALID" == 1 ]]; then
# echo "Release Tag ${{ env.RELEASE_TAG }} is not valid"
# exit 1
# fi

- name: Check tag is valid for pre-release
if: env.PRE_RELEASE == 'true'
Expand All @@ -74,6 +74,14 @@ jobs:
GIT_EMAIL: ${{ secrets.BUILD_GIT_EMAIL }}
GIT_USERNAME: ${{ secrets.BUILD_GIT_USERNAME }}

- name: Update Readme
env:
GITHUB_TOKEN: ${{ secrets.BUILD_GIT_TOKEN }}
run: |
./utils/update-readme-release.sh ${{ env.RELEASE_TAG }}
git add ./README.md
git commit -m 'Update Readme.md'
- name: Tag Release
env:
GITHUB_TOKEN: ${{ secrets.BUILD_GIT_TOKEN }}
Expand All @@ -87,6 +95,13 @@ jobs:
name: extracted_spec
path: ${{ github.workspace }}/


- name: Download EXCEL spec
uses: actions/download-artifact@v4
with:
name: excel_spec
path: ${{ github.workspace }}/

# --- Create Release --- #
- name: Push changes
run: |
Expand All @@ -105,43 +120,55 @@ jobs:
draft: false
prerelease: ${{ env.PRE_RELEASE }}

# --- Attach build assest --- #
# --- Attach build assests --- #
- name: Upload JSON Spec
id: upload-source-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BUILD_GIT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/${{ needs.build.outputs.spec_filename }}
asset_name: ${{ needs.build.outputs.spec_filename }}
asset_path: ${{ github.workspace }}/${{ needs.build.outputs.oed_json_spec }}
asset_name: ${{ needs.build.outputs.oed_json_spec }}
asset_content_type: application/octet-stream

# --- Slack notify --- #
- name: slack message vars
id: slack_vars
run: |
HEAD=$(echo "*${{ github.event.repository.name}} Release* (${{ env.RELEASE_TAG }})")
DATE=$(date)
TITLE=$(echo "• <https://github.com/${{ github.repository }}/releases/tag/${{ env.RELEASE_TAG }}|${{ github.event.repository.name }} ${{ env.RELEASE_TAG }} - Release Notes>")
JOB_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
echo "heading=$HEAD" >> $GITHUB_OUTPUT
echo "run_date=$DATE" >> $GITHUB_OUTPUT
echo "title=$TITLE" >> $GITHUB_OUTPUT
echo "run_url=$JOB_URL" >> $GITHUB_OUTPUT
echo "run_id=${{ github.run_id }}" >> $GITHUB_OUTPUT
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "run_status=${{ job.status }}" >> $GITHUB_OUTPUT
slack:
uses: OasisLMF/OasisLMF/.github/workflows/notify.yml@main
secrets: inherit
needs: release
with:
heading: ${{ needs.release.outputs.heading }}
title: ${{ needs.release.outputs.title }}
build_branch: ${{ needs.release.outputs.build_branch }}
run_url: ${{ needs.release.outputs.run_url }}
run_id: ${{ needs.release.outputs.run_id }}
run_status: ${{ needs.release.outputs.run_status }}
run_date: ${{ needs.release.outputs.run_date }}
- name: Upload EXCEL Spec
id: upload-excel-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BUILD_GIT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/${{ needs.build.outputs.oed_excel_spec }}
asset_name: ${{ needs.build.outputs.oed_excel_spec }}
asset_content_type: application/octet-stream


# # --- Slack notify --- #
# - name: slack message vars
# id: slack_vars
# run: |
# HEAD=$(echo "*${{ github.event.repository.name}} Release* (${{ env.RELEASE_TAG }})")
# DATE=$(date)
# TITLE=$(echo "• <https://github.com/${{ github.repository }}/releases/tag/${{ env.RELEASE_TAG }}|${{ github.event.repository.name }} ${{ env.RELEASE_TAG }} - Release Notes>")
# JOB_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
# echo "heading=$HEAD" >> $GITHUB_OUTPUT
# echo "run_date=$DATE" >> $GITHUB_OUTPUT
# echo "title=$TITLE" >> $GITHUB_OUTPUT
# echo "run_url=$JOB_URL" >> $GITHUB_OUTPUT
# echo "run_id=${{ github.run_id }}" >> $GITHUB_OUTPUT
# echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
# echo "run_status=${{ job.status }}" >> $GITHUB_OUTPUT
#
# slack:
# uses: OasisLMF/OasisLMF/.github/workflows/notify.yml@main
# secrets: inherit
# needs: release
# with:
# heading: ${{ needs.release.outputs.heading }}
# title: ${{ needs.release.outputs.title }}
# build_branch: ${{ needs.release.outputs.build_branch }}
# run_url: ${{ needs.release.outputs.run_url }}
# run_id: ${{ needs.release.outputs.run_id }}
# run_status: ${{ needs.release.outputs.run_status }}
# run_date: ${{ needs.release.outputs.run_date }}

0 comments on commit c0265b1

Please sign in to comment.