-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from taras/tm/publis-github-action
Publish GitHub Action
- Loading branch information
Showing
4 changed files
with
142 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: denoland/setup-deno@v2 | ||
with: | ||
deno-version: v2.x | ||
|
||
- run: mkdir bin | ||
|
||
- name: Get Version | ||
id: vars | ||
run: echo ::set-output name=version::$(echo ${{github.ref_name}} | sed 's/^v//') | ||
|
||
- name: Write Version file | ||
run: | | ||
touch VERSION | ||
echo ${{steps.vars.outputs.version}} > VERSION | ||
- name: Compile for Linux arm64 | ||
run: | | ||
deno compile \ | ||
--target=aarch64-unknown-linux-gnu \ | ||
--output=bin/staticalize-linux-arm64 \ | ||
--include=VERSION \ | ||
--allow-read --allow-write --allow-net main.ts | ||
- name: Compile for macOS arm64 | ||
run: | | ||
deno compile \ | ||
--target=aarch64-apple-darwin \ | ||
--output=bin/staticalize-macos-arm64 \ | ||
--include=VERSION \ | ||
--allow-read --allow-write --allow-net main.ts | ||
- name: Compile for Linux x64 | ||
run: | | ||
deno compile \ | ||
--target=x86_64-unknown-linux-gnu \ | ||
--output=bin/staticalize-linux \ | ||
--include=VERSION \ | ||
--allow-read --allow-write --allow-net main.ts | ||
- name: Compile for Windows x64 | ||
run: | | ||
deno compile \ | ||
--target=x86_64-pc-windows-msvc \ | ||
--output=bin/staticalize-windows \ | ||
--include=VERSION \ | ||
--allow-read --allow-write --allow-net main.ts | ||
- name: Compile for macOS x64 | ||
run: | | ||
deno compile \ | ||
--target=x86_64-apple-darwin \ | ||
--output=bin/staticalize-macos \ | ||
--include=VERSION \ | ||
--allow-read --allow-write --allow-net main.ts | ||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
make_latest: true | ||
files: | | ||
bin/* | ||
action.yaml | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Staticalize | ||
description: Create a static version of a website by traversing a dynamically evaluated sitemap.xml | ||
author: Frontside Engineering <[email protected]> | ||
inputs: | ||
site: | ||
description: "URL of the website to staticalize. E.g. http://localhost:8000" | ||
required: true | ||
output: | ||
description: Directory to place the downloaded site | ||
required: false | ||
default: dist | ||
base: | ||
description: "Base URL of the public website. E.g. http://frontside.com" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
# Define the binary to use based on the OS | ||
- name: Set binary path | ||
shell: bash | ||
run: | | ||
if [ "${{ runner.os }}" = "Linux" ] && [ "${{ runner.arch }}" = "X64" ]; then | ||
echo "BINARY=./bin/staticalize-linux-x64" >> $GITHUB_ENV | ||
elif [ "${{ runner.os }}" = "Linux" ] && [ "${{ runner.arch }}" = "ARM64" ]; then | ||
echo "BINARY=./bin/staticalize-linux-arm64" >> $GITHUB_ENV | ||
elif [ "${{ runner.os }}" = "Windows" ]; then | ||
echo "BINARY=./bin/staticalize-windows.exe" >> $GITHUB_ENV | ||
elif [ "${{ runner.os }}" = "macOS" ]; then | ||
echo "BINARY=./bin/staticalize-macos" >> $GITHUB_ENV | ||
else | ||
echo "Unsupported OS or architecture: ${{ runner.os }} / ${{ runner.arch }}" | ||
exit 1 | ||
fi | ||
# Make the binary executable (if needed) | ||
- name: Ensure executable permissions (Linux/macOS only) | ||
shell: bash | ||
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') | ||
run: chmod +x $BINARY | ||
|
||
# Run the binary | ||
- name: Run the selected binary | ||
shell: bash | ||
run: $BINARY \ | ||
--site=${{inputs.site}} \ | ||
--output=${{inputs.output}} \ | ||
--base=${{inputs.base}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters