Skip to content

Commit

Permalink
Verify the sha256sum of the binaries archive after downloading.
Browse files Browse the repository at this point in the history
  • Loading branch information
nstockton committed Sep 30, 2024
1 parent 038d9f0 commit c20a103
Showing 1 changed file with 104 additions and 89 deletions.
193 changes: 104 additions & 89 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,89 +1,104 @@
name: Main

on:
push:
branches:
- '**' # All branch names including slashes.
- '!gh-pages' # Except for gh-pages.
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches:
- '**' # All branch names including slashes.
- '!gh-pages' # Except for gh-pages.
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab.

env:
MUSHCLIENT_BINARIES: ${{ secrets.MUSHCLIENT_BINARIES }}

jobs:
build:
name: Build And Test
runs-on: windows-2022
defaults:
run:
shell: cmd
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # All history for all branches and tags.
submodules: 'recursive' # All submodules.
- name: Run Lua Tests
run: |
curl --location --output "mushclient-mume-binaries.zip" "%MUSHCLIENT_BINARIES%"
if exist "mushclient-mume-binaries.zip" echo Binaries file downloaded.
7z x -y -tzip "mushclient-mume-binaries.zip"
del /q /f "mushclient-mume-binaries.zip"
git archive --format tar --prefix "mushclient-mume/" HEAD | 7z x -y -ttar -si
del /q /f "pax_global_header"
"mushclient-mume\test.bat"
deploy:
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
name: Deploy Release
runs-on: windows-2022
permissions:
contents: write
defaults:
run:
shell: cmd
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # All history for all branches and tags.
submodules: 'recursive' # All submodules.
- name: Get Project Info
id: project_info
run: |
NAME='MUSHclient MUME'
VERSION=${GITHUB_REF#refs/tags/v} # Everything after the v.
echo "name=${NAME}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Download Mushclient Binaries
env:
ZIP_FILE: mushclient-mume-v${{ steps.project_info.outputs.version }}
run: |
curl --location --output "mushclient-mume-binaries.zip" "%MUSHCLIENT_BINARIES%"
if exist "mushclient-mume-binaries.zip" echo Binaries file downloaded.
7z x -y -tzip "mushclient-mume-binaries.zip"
del /q /f "mushclient-mume-binaries.zip"
git archive --format tar --prefix "mushclient-mume/" HEAD | 7z x -y -ttar -si
del /q /f "pax_global_header"
7z a -y -tzip "%ZIP_FILE%" "mushclient-mume"
"mushclient-mume\luajit.exe" -l "mystdlib" -e "print(sha256sum_file('%ZIP_FILE%') .. ' %ZIP_FILE%')" >"%ZIP_FILE%.sha256"
rmdir /q /s "mushclient-mume"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by Actions.
name: ${{ steps.project_info.outputs.name }} Version ${{ steps.project_info.outputs.version }}
body: Auto-generated release.
draft: false
prerelease: false
fail_on_unmatched_files: true
files: |
mushclient-mume-v*.zip
mushclient-mume-v*.zip.sha256
name: Main

on:
push:
branches:
- '**' # All branch names including slashes.
- '!gh-pages' # Except for gh-pages.
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches:
- '**' # All branch names including slashes.
- '!gh-pages' # Except for gh-pages.
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab.

env:
MUSHCLIENT_BINARIES: ${{ secrets.MUSHCLIENT_BINARIES }}

jobs:
build:
name: Build And Test
runs-on: windows-2022
defaults:
run:
shell: cmd
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # All history for all branches and tags.
submodules: 'recursive' # All submodules.
- name: Download and Extract Binaries
shell: bash
run: |
curl --location --output "mushclient-mume-binaries.zip" "${MUSHCLIENT_BINARIES}"
echo Verifying checksum.
sha256sum -c "mushclient-mume-binaries.zip.sha256"
echo Extracting.
7z x -y -tzip "mushclient-mume-binaries.zip"
rm -f "mushclient-mume-binaries.zip"
- name: Merge Source Code
run: |
git archive --format tar --prefix "mushclient-mume/" HEAD | 7z x -y -ttar -si
if exist "pax_global_header" del /q /f "pax_global_header"
- name: Run Lua Tests
run: |
"mushclient-mume\test.bat"
deploy:
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
name: Deploy Release
runs-on: windows-2022
permissions:
contents: write
defaults:
run:
shell: cmd
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # All history for all branches and tags.
submodules: 'recursive' # All submodules.
- name: Get Project Info
id: project_info
run: |
NAME='MUSHclient MUME'
VERSION=${GITHUB_REF#refs/tags/v} # Everything after the v.
echo "name=${NAME}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Download and Extract Binaries
shell: bash
run: |
curl --location --output "mushclient-mume-binaries.zip" "${MUSHCLIENT_BINARIES}"
echo Verifying checksum.
sha256sum -c "mushclient-mume-binaries.zip.sha256"
echo Extracting.
7z x -y -tzip "mushclient-mume-binaries.zip"
rm -f "mushclient-mume-binaries.zip"
- name: Merge Source Code
run: |
git archive --format tar --prefix "mushclient-mume/" HEAD | 7z x -y -ttar -si
if exist "pax_global_header" del /q /f "pax_global_header"
- name: Create Bundle
shell: bash
env:
ZIP_FILE: mushclient-mume-v${{ steps.project_info.outputs.version }}
run: |
7z a -y -tzip "${ZIP_FILE}" "mushclient-mume"
sha256sum "${ZIP_FILE}" >"${ZIP_FILE}.sha256"
rm -rf "mushclient-mume"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by Actions.
name: ${{ steps.project_info.outputs.name }} Version ${{ steps.project_info.outputs.version }}
body: Auto-generated release.
draft: false
prerelease: false
fail_on_unmatched_files: true
files: |
mushclient-mume-v*.zip
mushclient-mume-v*.zip.sha256

0 comments on commit c20a103

Please sign in to comment.