Skip to content

ensure if-test using "-literal aorund test-variable #76

ensure if-test using "-literal aorund test-variable

ensure if-test using "-literal aorund test-variable #76

Workflow file for this run

name: 'Release smud CLI'
on:
workflow_dispatch: # click the button on Github repo!
push:
branches: [main]
paths-ignore:
- "**/README.md"
jobs:
release_smud_cli:
strategy:
matrix:
os: [ ubuntu-latest]
# os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
timeout-minutes: 360
env:
BUILD_ID: ${{ github.run_number }}
name: Release smud CLI
steps:
# REQUIRED step
# Step 1: run a standard checkout action, provided by github
- name: Checkout target repo
uses: actions/checkout@v3
with:
# optional: set the branch to checkout,
# sync action checks out your 'target_sync_branch' anyway
ref: main
# REQUIRED if your upstream repo is private (see wiki)
persist-credentials: false
- name: Parse Changelog
id: changelog
uses: ocavue/changelog-parser-action@v1
with:
filePath: "./CHANGELOG.md"
- name: Export version to variable
run: echo "CLI_VERSION=${{ steps.changelog.outputs.latestVersion }}" >> $GITHUB_ENV
shell: bash
- name: Export DEST_FOLDER folder to variable
run: echo "DEST_FOLDER=dist" >> $GITHUB_ENV
shell: bash
- name: Export DEST_BASE_FILENAME to variable
run: echo "DEST_BASE_FILENAME=${{ env.DEST_FOLDER }}/Release/smud-cli-${{ env.CLI_VERSION }}-${{ env.BUILD_ID }}" >> $GITHUB_ENV
shell: bash
- name: Export DEST_BASE_FILENAME_Latest to variable
run: echo "DEST_BASE_FILENAME_Latest=${{ env.DEST_FOLDER }}/Latest/smud-cli-Latest" >> $GITHUB_ENV
shell: bash
- name: Export PAT
run: echo "PAT=$(echo "WjJod1gxTjZkekZIWVdaVVkwUm9iVk5VYzAxWFdFcE5PR2RSU2xGSlozQlpSekprUlZkdVF3PT0=" | base64 --decode | base64 --decode)" >> $GITHUB_ENV
shell: bash
- name: Build Package
shell: bash
run: |
mkdir ${{ env.DEST_FOLDER }}
# Release
mkdir ${{ env.DEST_FOLDER }}/Release
zip -rj ${{ env.DEST_BASE_FILENAME }}.zip smud-cli/* CHANGELOG.md
cp smud-cli/download-and-install-cli.sh ${{ env.DEST_FOLDER }}/Release/download-and-install-cli.sh
# Latest
mkdir ${{ env.DEST_FOLDER }}/Latest
zip -rj ${{ env.DEST_BASE_FILENAME_Latest }}.zip smud-cli/* CHANGELOG.md
cp smud-cli/download-and-install-cli.sh ${{ env.DEST_FOLDER }}/Latest/download-and-install-cli.sh
- name: Calculate Release SHA256 checksum
run: |-
if command -v shasum 2>/dev/null 1>&2; then
for filename in *.*; do shasum -a 256 "${filename}" | tee "${filename}.sha256" ; done
else
for filename in *.*; do certutil -hashfile "${filename}" SHA256 | tee "${filename}.sha256" ; done
fi
working-directory: ${{ env.DEST_FOLDER }}/Release
shell: bash
- name: Calculate Latest SHA256 checksum
run: |-
if command -v shasum 2>/dev/null 1>&2; then
for filename in *.*; do shasum -a 256 "${filename}" | tee "${filename}.sha256" ; done
else
for filename in *.*; do certutil -hashfile "${filename}" SHA256 | tee "${filename}.sha256" ; done
fi
working-directory: ${{ env.DEST_FOLDER }}/Latest
shell: bash
- name: Generate Changelog
run: curl -s https://api.github.com/repos/DIPSAS/spud-cli/releases/latest | jq -r 'select(.prerelease == false) | .body[0:]' > ${{ github.workspace }}-CHANGELOG.txt
# - name: Upload Artifacts
# uses: actions/upload-artifact@v3
# with:
# name: smud-cli-artifacts
# path: |
# ${{ env.DEST_FOLDER}}/Release/*.*
# ${{ env.DEST_FOLDER}}/Latest/*.*
- name: Release
if: github.ref == 'refs/heads/main'
uses: softprops/[email protected]
with:
tag_name: v${{ env.CLI_VERSION }}-${{ env.BUILD_ID }}
body_path: ${{ github.workspace }}-CHANGELOG.txt
token: ${{ env.PAT }}
files: ${{ env.DEST_FOLDER}}/Release/*.*
- name: Latest
if: github.ref == 'refs/heads/main'
uses: softprops/[email protected]
with:
tag_name: Latest
body_path: ${{ github.workspace }}-CHANGELOG.txt
token: ${{ env.PAT }}
files: ${{ env.DEST_FOLDER}}/Latest/*.*