Skip to content

Commit

Permalink
chore: fix ci pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
aooohan committed Dec 20, 2023
1 parent 4fd9cdd commit 8ffc91a
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 72 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/compile-inno-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: compile-inno-setup

on:
release:
types: [released]

permissions:
contents: write
id-token: write
packages: write

jobs:
compile-inno-setup:
name: Compile setup and publish
runs-on: windows-latest
defaults:
run:
working-directory: inno_setup
steps:
- name: Checkout version-fox
uses: actions/checkout@v3
- name: Get version-fox version
id: version-fox-version
uses: actions/github-script@v6
with:
github-token: NO_NEED
result-encoding: string
script: return "${{ github.ref }}".substring(11)
- name: Install Inno Setup
run: |
curl --retry 10 --retry-all-errors -L -o installer.exe https://jrsoftware.org/download.php/is.exe
./installer.exe /verysilent /allusers /dir=inst
sleep 60
- name: Download version-fox packages
env:
VFOX_VERSION: ${{ steps.version-fox-version.outputs.result }}
DOWNLOAD_URL: https://github.com/${{ github.event.repository.full_name }}/releases/download
run: |
curl -L -o i386.zip ${{ env.DOWNLOAD_URL }}/v${{ env.VFOX_VERSION }}/vfox_${{ env.VFOX_VERSION }}_windows_i386.zip && unzip i386.zip
curl -L -o x86_64.zip ${{ env.DOWNLOAD_URL }}/v${{ env.VFOX_VERSION }}/vfox_${{ env.VFOX_VERSION }}_windows_x86_64.zip && unzip x86_64.zip
curl -L -o aarch64.zip ${{ env.DOWNLOAD_URL }}/v${{ env.VFOX_VERSION }}/vfox_${{ env.VFOX_VERSION }}_windows_aarch64.zip && unzip aarch64.zip
- name: Compile by Inno Setup
env:
VFOX_VERSION: ${{ steps.version-fox-version.outputs.result }}
run: |
./inst/iscc vfox_windows_i386.iss
./inst/iscc vfox_windows_x86_64.iss
./inst/iscc vfox_windows_aarch64.iss
- name: Upload Inno Setup Assets
uses: version-fox/vfox-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ github.event.release.id }}
assets_path: inno_setup/Output/*.exe
48 changes: 2 additions & 46 deletions .github/workflows/go-releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
args: release --clean ${{ env.flags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_PWD: ${{ secrets.COSIGN_PWD }}
HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN}}

- name: Publish rpm to Gemfury
Expand All @@ -39,49 +40,4 @@ jobs:
run: |
for filename in dist/vfox*.rpm; do
curl -F package=@"$filename" https://{$FURY_TOKEN}@push.fury.io/versionfox/
done
compile-inno-setup:
name: Compile setup and publish
needs: release
runs-on: windows-latest
defaults:
run:
working-directory: inno_setup
steps:
- name: Checkout version-fox
uses: actions/checkout@v3
- name: Get version-fox version
id: version-fox-version
uses: actions/github-script@v6
with:
github-token: NO_NEED
result-encoding: string
script: return "${{ github.event.release.tag_name }}".substring(1)
- name: Install Inno Setup
run: |
curl --retry 10 --retry-all-errors -L -o installer.exe https://jrsoftware.org/download.php/is.exe
./installer.exe /verysilent /allusers /dir=inst
sleep 60
- name: Download version-fox packages
env:
VFOX_VERSION: ${{ steps.version-fox-version.outputs.result }}
DOWNLOAD_URL: https://github.com/${{ github.event.repository.full_name }}/releases/download
run: |
curl -L -o i386.zip ${{ env.DOWNLOAD_URL }}/v${{ env.VFOX_VERSION }}/vfox_${{ env.VFOX_VERSION }}_windows_i386.zip && unzip i386.zip
curl -L -o x86_64.zip ${{ env.DOWNLOAD_URL }}/v${{ env.VFOX_VERSION }}/vfox_${{ env.VFOX_VERSION }}_windows_x86_64.zip && unzip x86_64.zip
curl -L -o aarch64.zip ${{ env.DOWNLOAD_URL }}/v${{ env.VFOX_VERSION }}/vfox_${{ env.VFOX_VERSION }}_windows_aarch64.zip && unzip aarch64.zip
- name: Compile by Inno Setup
env:
TRZSZ_VERSION: ${{ steps.version-fox-version.outputs.result }}
run: |
./inst/iscc vfox_windows_i386.iss
./inst/iscc vfox_windows_x86_64.iss
./inst/iscc vfox_windows_aarch64.iss
- name: Upload Inno Setup Assets
uses: trzsz/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ github.event.release.id }}
assets_path: inno_setup/Output/*.exe
done
10 changes: 2 additions & 8 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,10 @@ signs:
- "--output-signature=${signature}"
- "${artifact}"
- --yes
docker_signs:
- cmd: cosign
artifacts: manifests
output: true
args:
- "sign"
- "${artifact}@${digest}"
- --yes

release:
draft: false
prerelease: true
name_template: "v{{ .Version }}"
footer: |
**Full Changelog**: https://github.com/version-fox/vfox/compare/{{ .PreviousTag }}...{{ if .IsNightly }}nightly{{ else }}{{ .Tag }}{{ end }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ assert(resp.body == '{"ip": "xxx.xxx.xxx.xxx"}')
##### 2. JSON Library
Based on [gopher-json](https://github.com/layeh/gopher-json/)
```lua
local json = require("json")
Expand Down
2 changes: 1 addition & 1 deletion inno_setup/vfox_windows_aarch64.iss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=vfox_{#MyAppVersion}_windows_setup_aarch64
Compression=lzma
Compression=zip
SolidCompression=yes
WizardStyle=modern
ChangesEnvironment=true
Expand Down
2 changes: 1 addition & 1 deletion inno_setup/vfox_windows_i386.iss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=vfox_{#MyAppVersion}_windows_setup_i386
Compression=lzma
Compression=zip
SolidCompression=yes
WizardStyle=modern
ChangesEnvironment=true
Expand Down
2 changes: 1 addition & 1 deletion inno_setup/vfox_windows_x86_64.iss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=vfox_{#MyAppVersion}_windows_setup_x86_64
Compression=lzma
Compression=zip
SolidCompression=yes
WizardStyle=modern
ChangesEnvironment=true
Expand Down
30 changes: 15 additions & 15 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,41 +29,41 @@ else
fi

# Get the latest version
VERSION=$(curl --silent "https://api.github.com/repos/version-fox/vfox/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
VERSION=$(curl --silent "https://api.github.com/repos/version-fox/vfox/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-)

if [ -z "$VERSION" ]; then
echo "Failed to get the latest version. Please check your network connection and try again."
exit 1
fi
echo "Installing vfox $VERSION ..."
echo "Installing vfox v$VERSION ..."

# Check if the OS is supported
OS_TYPE=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH_TYPE=$(uname -m)
if [ "$ARCH_TYPE" = "x86_64" ]; then
ARCH_TYPE="amd64"
elif [ "$ARCH_TYPE" = "aarch64" ]; then
ARCH_TYPE="arm64"
else
echo "Unsupported architecture type: $ARCH_TYPE"
exit 1
if [ "$OS_TYPE" = "darwin" ]; then
OS_TYPE="macos"
fi

FILENAME="version-fox_${VERSION}_${OS_TYPE}_${ARCH_TYPE}.tar.gz"
ARCH_TYPE=$(uname -m)

FILENAME="vfox_${VERSION}_${OS_TYPE}_${ARCH_TYPE}"
TAR_FILE="${FILENAME}.tar.gz"

echo https://github.com/version-fox/vfox/releases/download/v$VERSION/$TAR_FILE
$DOWNLOAD_CMD https://github.com/version-fox/vfox/releases/download/v$VERSION/$TAR_FILE

$DOWNLOAD_CMD https://github.com/version-fox/vfox/releases/download/$VERSION/$FILENAME

tar -zxvf $FILENAME
tar -zxvf $TAR_FILE
if [ $? -ne 0 ]; then
echo "Failed to extract vfox binary. Please check if the downloaded file is a valid tar.gz file."
exit 1
fi

sudo mv vf /usr/local/bin
sudo mv "${FILENAME}/vfox" /usr/local/bin

if [ $? -ne 0 ]; then
echo "Failed to move vfox to /usr/local/bin. Please check your sudo permissions and try again."
exit 1
fi
rm $FILENAME
rm $TAR_FILE
rm -rf $FILENAME
echo "vfox installed successfully!"

0 comments on commit 8ffc91a

Please sign in to comment.