From 8ffc91a2ce1e81a10e1f9d1802c92135e810a62e Mon Sep 17 00:00:00 2001 From: lihan Date: Wed, 20 Dec 2023 16:40:10 +0800 Subject: [PATCH] chore: fix ci pipeline --- .github/workflows/compile-inno-setup.yml | 55 ++++++++++++++++++++++++ .github/workflows/go-releaser.yml | 48 +-------------------- .goreleaser.yaml | 10 +---- README.md | 2 + inno_setup/vfox_windows_aarch64.iss | 2 +- inno_setup/vfox_windows_i386.iss | 2 +- inno_setup/vfox_windows_x86_64.iss | 2 +- install.sh | 30 ++++++------- 8 files changed, 79 insertions(+), 72 deletions(-) create mode 100644 .github/workflows/compile-inno-setup.yml diff --git a/.github/workflows/compile-inno-setup.yml b/.github/workflows/compile-inno-setup.yml new file mode 100644 index 00000000..7e1ddc30 --- /dev/null +++ b/.github/workflows/compile-inno-setup.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/go-releaser.yml b/.github/workflows/go-releaser.yml index 97390248..ffa89da4 100644 --- a/.github/workflows/go-releaser.yml +++ b/.github/workflows/go-releaser.yml @@ -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 @@ -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 \ No newline at end of file + done \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 12472c0d..565cd0b5 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -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 }} \ No newline at end of file diff --git a/README.md b/README.md index 4d450640..41752959 100644 --- a/README.md +++ b/README.md @@ -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") diff --git a/inno_setup/vfox_windows_aarch64.iss b/inno_setup/vfox_windows_aarch64.iss index c54e36c4..a2e0751b 100644 --- a/inno_setup/vfox_windows_aarch64.iss +++ b/inno_setup/vfox_windows_aarch64.iss @@ -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 diff --git a/inno_setup/vfox_windows_i386.iss b/inno_setup/vfox_windows_i386.iss index 596c0ada..834a35e9 100644 --- a/inno_setup/vfox_windows_i386.iss +++ b/inno_setup/vfox_windows_i386.iss @@ -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 diff --git a/inno_setup/vfox_windows_x86_64.iss b/inno_setup/vfox_windows_x86_64.iss index f5c566d4..c5b41983 100644 --- a/inno_setup/vfox_windows_x86_64.iss +++ b/inno_setup/vfox_windows_x86_64.iss @@ -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 diff --git a/install.sh b/install.sh index 3594dad5..503790d7 100755 --- a/install.sh +++ b/install.sh @@ -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!" \ No newline at end of file