Build, deploy and release 7z-GUI-Linux #69
Workflow file for this run
This file contains hidden or 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 workflow will build a golang project and deploy the compiled binary to GitHub Pages | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
| name: Build, deploy and release 7z-GUI-Linux | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: # | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: write # Needed for Releases | |
| pages: write # To deploy to Pages | |
| id-token: write # To verify the deployment originates from an appropriate source | |
| attestations: write | |
| jobs: | |
| # Build job | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 # Ensures full history, including tags | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v6 | |
| - name: Install Tools | |
| env: | |
| GOTOOLCHAIN: auto | |
| run: | | |
| sudo apt-get update | |
| go install github.com/fyne-io/fyne-cross@latest # Use the fyne-cross tool | |
| - name: Set up GIT_TAG for Dynamic Folder Names | |
| run: | | |
| # Save to GITHUB_ENV so subsequent steps can use these variables | |
| echo "GIT_TAG=$(git describe --tags --always)" >> $GITHUB_ENV | |
| - name: Inject Git Tag into Version | |
| run: | | |
| echo "package main" > version.go | |
| echo "var version string = \"${{ env.GIT_TAG }}\"" >> version.go | |
| - name: Cross-Compile, Optimize, and Compress | |
| env: | |
| URL_386: "https://github.com/ip7z/7zip/releases/download/26.02/7z2602-linux-x86.tar.xz" | |
| URL_AMD64: "https://github.com/ip7z/7zip/releases/download/26.02/7z2602-linux-x64.tar.xz" | |
| URL_ARM64: "https://github.com/ip7z/7zip/releases/download/26.02/7z2602-linux-arm64.tar.xz" | |
| run: | | |
| mkdir -p ./public | |
| NAME="7z-GUI-Linux" | |
| archs=("amd64" "386" "arm64") | |
| servers=("x11" "wayland") | |
| for arch in "${archs[@]}"; do | |
| echo "========================================================" | |
| echo "Downloading 7zzs for architecture: ${arch}" | |
| echo "========================================================" | |
| case $arch in | |
| "386") | |
| DL_URL="${URL_386}" | |
| ;; | |
| "amd64") | |
| DL_URL="${URL_AMD64}" | |
| ;; | |
| "arm64") | |
| DL_URL="${URL_ARM64}" | |
| ;; | |
| esac | |
| # Download and extract 7zzs once per architecture | |
| curl -f -L "${DL_URL}" -o "downloaded_7z_${arch}.tar.xz" | |
| mkdir -p "temp_extract_${arch}" | |
| tar -xf "downloaded_7z_${arch}.tar.xz" -C "temp_extract_${arch}" | |
| for server in "${servers[@]}"; do | |
| echo "--------------------------------------------------------" | |
| echo "Building for Linux ${arch} (${server})" | |
| echo "--------------------------------------------------------" | |
| # Dynamic Tags setup | |
| TAGS="no_emoji,no_animations,no_metadata" | |
| if [ "${server}" = "wayland" ]; then | |
| TAGS="wayland,no_emoji,no_animations,no_metadata" | |
| fi | |
| # Setup Staging Areas | |
| STAGING_DIR="./staging" | |
| STAGING_DEBUG_DIR="./debug-staging" | |
| rm -rf "${STAGING_DIR}" "${STAGING_DEBUG_DIR}" | |
| mkdir -p "${STAGING_DIR}" "${STAGING_DEBUG_DIR}" | |
| echo "------------ fyne-cross working... ------------" | |
| echo "------------ RELEASE BUILD... ------------" | |
| # we have removed -s and -w from ldflags for now as fyne-cross has issues passing ldflags to Go | |
| # -release flag doesn't work. https://github.com/fyne-io/fyne-cross/issues/272 | |
| fyne-cross linux \ | |
| --arch ${arch} \ | |
| --env GOTOOLCHAIN=auto \ | |
| --tags "${TAGS}" \ | |
| --icon "assets/logo.png" \ | |
| --name "${NAME}" | |
| echo "--- Directory structure for fyne-cross: ---" | |
| ls -R fyne-cross | |
| echo "--- End of directory structure ---" | |
| # fyne-cross names the binary after name of the folder in which main package is | |
| RAW_BINARY_OUTPUT="./fyne-cross/bin/linux-${arch}/7z-gui-linux" | |
| echo "Checking if release binary exists before proceeding" | |
| if [ ! -f "${RAW_BINARY_OUTPUT}" ]; then | |
| echo "Error: Release binary for ${arch} (${server}) not found at ${RAW_BINARY_OUTPUT}" | |
| exit 1 | |
| fi | |
| # Move release binary to staging | |
| mv "${RAW_BINARY_OUTPUT}" "${STAGING_DIR}/${NAME}" | |
| echo "Done: Release binary moved to staging." | |
| echo "------------ fyne-cross worked hard. ------------" | |
| echo "Copy supporting files" | |
| cp ./dist/release/install.sh "${STAGING_DIR}/" || true | |
| cp ./dist/release/update.sh "${STAGING_DIR}/" || true | |
| cp ./dist/release/uninstall.sh "${STAGING_DIR}/" || true | |
| cp ./README.md "${STAGING_DIR}/" || true | |
| cp ./assets/logo.png "${STAGING_DIR}/${NAME}.png" || true | |
| cp ./dist/release/7z-GUI-Linux.desktop "${STAGING_DIR}/" || true | |
| echo "Done" | |
| # Copy downloaded 7zzs files from pre-extracted folder | |
| # Find 7zzs file and copy it to STAGING_DIR (futureproofing with find, in case it's in a nested folder in future) | |
| find "temp_extract_${arch}" -type f -name "7zzs" -exec cp {} "${STAGING_DIR}/" \; | |
| find "temp_extract_${arch}" -type f -iname "license*" -exec cp {} "${STAGING_DIR}/7-zip.license" \; | |
| chmod +x "${STAGING_DIR}/7zzs" | |
| echo "Create Archive" | |
| TAR_NAME="${NAME}-${server}-${arch}-${{ env.GIT_TAG }}.tar.xz" | |
| echo "Compressing to ${TAR_NAME}..." | |
| tar -cJf "./public/${TAR_NAME}" -C "${STAGING_DIR}" . | |
| sha256sum "./public/${TAR_NAME}" > "./public/${TAR_NAME}.sha256" | |
| echo "Done" | |
| # Cleanup for next server iteration | |
| echo "Cleaning up staging and build files for ${arch} (${server})..." | |
| rm -rf "${STAGING_DIR}" | |
| rm -rf "./fyne-cross/bin/linux-${arch}" | |
| echo "Done" | |
| done | |
| # Cleanup 7z download for this architecture | |
| rm -rf "temp_extract_${arch}" "downloaded_7z_${arch}.tar.xz" | |
| done | |
| - name: Output the files structure into a JSON file | |
| run: | | |
| tree -J public > files.json | |
| cp -r files.json ./public/ | |
| echo "JSON Manifest generated!" | |
| - name: Make web pages available | |
| run: | | |
| # Ensure dist/pages exists, or handle if it doesn't | |
| if [ -d "./dist/pages" ]; then | |
| cp -r ./dist/pages/* ./public/ | |
| fi | |
| echo "Web assets ready!" | |
| - name: Upload artifact | |
| # upload artifact in the build stage, so that it is later on accessible in the deploy stage | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| # Upload entire repository | |
| path: './public' | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v3 | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') # Only run for tags | |
| with: | |
| draft: true | |
| body: >- | |
| Thank you for using this tool! | |
| **Installation:** | |
| - Download the `.tar.xz` for your display server (x11 or wayland) and architecture below. | |
| - Make the `install.sh` script executable (right click -> properties -> permissions -> Make executable). | |
| - Double click `install.sh` to install. | |
| - You now have 7z-GUI-Linux installed! | |
| Star this repo if you find this tool useful! | |
| --- | |
| generate_release_notes: true | |
| files: | | |
| public/*.tar.xz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Deploy job | |
| deploy: | |
| # Add a dependency to the build job | |
| needs: build | |
| # Deploy to the github-pages environment | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| # Specify runner + deployment step | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |