Create Release #24
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
| name: Create Release | |
| on: | |
| workflow_dispatch: | |
| env: | |
| IMAGE_NAME: wg-obfuscator | |
| PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/arm/v5,linux/386,linux/ppc64le,linux/s390x | |
| MUSL_RELEASE: https://github.com/cross-tools/musl-cross/releases/download/20250520/ | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Prepare version | |
| id: prep | |
| run: | | |
| VERSION=$(grep WG_OBFUSCATOR_VERSION wg-obfuscator.h | awk '{print $3}' | sed 's|"||g' | tr -d '\r') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| id: create_release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: v${{ steps.prep.outputs.version }} | |
| commit: ${{ github.head_ref || github.ref_name }} | |
| name: v${{ steps.prep.outputs.version }} | |
| draft: true | |
| - name: Output Release URL File | |
| run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt | |
| - name: Save Release URL File for publish | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release_url | |
| path: release_url.txt | |
| build-docker: | |
| needs: create-release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| strategy: | |
| matrix: | |
| platform: [linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6, linux/arm/v5, linux/386, linux/ppc64le, linux/s390x] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Prepare filename, tag and version | |
| id: prep | |
| run: | | |
| SAFE_PLATFORM="${{ matrix.platform }}" | |
| SAFE_PLATFORM=$(echo "$SAFE_PLATFORM" | sed 's|linux/||;s|/|-|g') | |
| echo "safe_platform=$SAFE_PLATFORM" >> $GITHUB_OUTPUT | |
| VERSION=$(grep WG_OBFUSCATOR_VERSION wg-obfuscator.h | awk '{print $3}' | sed 's|"||g' | tr -d '\r') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Build per-arch image and export as tar | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: false | |
| tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_NAME }}-${{ steps.prep.outputs.safe_platform }} | |
| platforms: ${{ matrix.platform }} | |
| outputs: type=docker,dest=${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-docker-${{ steps.prep.outputs.safe_platform }}.tar | |
| context: . | |
| - name: Load Release URL File from release job | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: release_url | |
| - name: Get Release File Name & Upload URL | |
| id: get_release_info | |
| run: | | |
| value=`cat release_url.txt` | |
| echo upload_url=$value >> $GITHUB_OUTPUT | |
| - name: Upload to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.get_release_info.outputs.upload_url }} | |
| asset_path: ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-docker-${{ steps.prep.outputs.safe_platform }}.tar | |
| asset_name: ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-docker-${{ steps.prep.outputs.safe_platform }}.tar | |
| asset_content_type: tar | |
| build-linux: | |
| needs: create-release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| strategy: | |
| matrix: | |
| target: | |
| # name packages musl CC CFLAGS LDFLAGS | |
| # ======================== x86_64 / x86 ======================== | |
| - [x86, gcc-i686-linux-gnu, "", i686-linux-gnu-gcc, "", "-static"] | |
| #[x86, "", i686-unknown-linux-musl, i686-unknown-linux-musl-gcc, "", "-static"] | |
| - [x64, "", "", gcc, "", "-static"] | |
| #[x64-musl, "", x86_64-unknown-linux-musl, x86_64-unknown-linux-musl-gcc, "", "-static"] | |
| # ======================== ARM (32-bit) ========================= | |
| - [armv5-sf, gcc-arm-linux-gnueabi, "", arm-linux-gnueabi-gcc, "-march=armv5te -mfloat-abi=soft", "-static"] | |
| #[armv5-musl-sf, "", arm-unknown-linux-musleabi, arm-unknown-linux-musleabi-gcc, "-march=armv5te -mfloat-abi=soft", "-static"] | |
| - [armv6-softfp, gcc-arm-linux-gnueabi, "", arm-linux-gnueabi-gcc, "-march=armv6 -mfpu=vfp -mfloat-abi=softfp", "-static"] | |
| #[armv6-musl-softfp, "", arm-unknown-linux-musleabi, arm-unknown-linux-musleabi-gcc, "-march=armv6 -mfpu=vfp -mfloat-abi=softfp", "-static"] | |
| #[armv7-sf, gcc-arm-linux-gnueabi, "", arm-linux-gnueabi-gcc, "-march=armv7-a -mfloat-abi=soft", "-static"] | |
| #[armv7-sf, "", armv7-unknown-linux-musleabi, armv7-unknown-linux-musleabi-gcc, "-march=armv7-a -mfloat-abi=soft", "-static"] | |
| - [armv7-softfp, gcc-arm-linux-gnueabi, "", arm-linux-gnueabi-gcc, "-march=armv7-a -mfpu=vfp -mfloat-abi=softfp", "-static"] | |
| #[armv7-softfp, "", armv7-unknown-linux-musleabi, armv7-unknown-linux-musleabi-gcc, "-march=armv7-a -mfpu=vfp -mfloat-abi=softfp", "-static"] | |
| - [armv7-hf, gcc-arm-linux-gnueabihf, "", arm-linux-gnueabihf-gcc, "-march=armv7-a -mfpu=vfp -mfloat-abi=hard", "-static"] | |
| #[armv7-hf, "", armv7-unknown-linux-musleabihf, armv7-unknown-linux-musleabihf-gcc, "-march=armv7-a -mfpu=vfp -mfloat-abi=hard", "-static"] | |
| - [arm64, gcc-aarch64-linux-gnu, "", aarch64-linux-gnu-gcc, "", "-static"] | |
| #[arm64, "", aarch64-unknown-linux-musl, aarch64-unknown-linux-musl-gcc, "", "-static"] | |
| # ======================== MIPS little-endian ==================== | |
| - [mipsel-mips1, gcc-mipsel-linux-gnu, "", mipsel-linux-gnu-gcc, "-march=mips1 -mabi=32 -mfp32", "-static"] | |
| - [mipsel-mips32, gcc-mipsel-linux-gnu, "", mipsel-linux-gnu-gcc, "-march=mips32 -mabi=32", "-static"] | |
| #[mipsel-mips32, "", mipsel-unknown-linux-musl, mipsel-unknown-linux-musl-gcc, "-march=mips32 -mabi=32", "-static"] | |
| - [mipsel-mips32r2, gcc-mipsel-linux-gnu, "", mipsel-linux-gnu-gcc, "-march=mips32r2 -mabi=32", "-static"] | |
| #[mipsel-mips32r2, "", mipsel-unknown-linux-musl, mipsel-unknown-linux-musl-gcc, "-march=mips32r2 -mabi=32", "-static"] | |
| - [mips64el, gcc-mips64el-linux-gnuabi64, "", mips64el-linux-gnuabi64-gcc, "-march=mips64 -mabi=64", "-static"] | |
| #[mips64el, "", mips64el-unknown-linux-musl, mips64el-unknown-linux-musl-gcc, "-march=mips64 -mabi=64", "-static"] | |
| - [mips64elr2, gcc-mips64el-linux-gnuabi64, "", mips64el-linux-gnuabi64-gcc, "-march=mips64r2 -mabi=64", "-static"] | |
| #[mips64elr2, "", mips64el-unknown-linux-musl, mips64el-unknown-linux-musl-gcc, "-march=mips64r2 -mabi=64", "-static"] | |
| - [mipsel-mips32-sf, "", mipsel-unknown-linux-muslsf, mipsel-unknown-linux-muslsf-gcc, "-march=mips32 -mabi=32", "-static"] | |
| # ======================== MIPS big-endian ======================= | |
| - [mips-mips1, gcc-mips-linux-gnu, "", mips-linux-gnu-gcc, "-march=mips1 -mabi=32 -mfp32", "-static"] | |
| - [mips-mips32, gcc-mips-linux-gnu, "", mips-linux-gnu-gcc, "-march=mips32 -mabi=32", "-static"] | |
| #[mips-mips32, "", mips-unknown-linux-musl, mips-unknown-linux-musl-gcc, "-march=mips32 -mabi=32", "-static"] | |
| - [mips-mips32r2, gcc-mips-linux-gnu, "", mips-linux-gnu-gcc, "-march=mips32r2 -mabi=32", "-static"] | |
| #[mips-mips32r2, "", mips-unknown-linux-musl, mips-unknown-linux-musl-gcc, "-march=mips32r2 -mabi=32", "-static"] | |
| - [mips64, gcc-mips64-linux-gnuabi64, "", mips64-linux-gnuabi64-gcc, "-march=mips64 -mabi=64", "-static"] | |
| #[mips64, "", mips64-unknown-linux-musl, mips64-unknown-linux-musl-gcc, "-march=mips64 -mabi=64", "-static"] | |
| - [mips64r2, gcc-mips64-linux-gnuabi64, "", mips64-linux-gnuabi64-gcc, "-march=mips64r2 -mabi=64", "-static"] | |
| - [mips-mips32-sf, "", mips-unknown-linux-muslsf, mips-unknown-linux-muslsf-gcc, "-march=mips32 -mabi=32", "-static"] | |
| # ======================== other architectures ================= | |
| - [ppc64le, gcc-powerpc64le-linux-gnu, "", powerpc64le-linux-gnu-gcc, "", "-static"] | |
| #[ppc64le-musl, "", powerpc64-unknown-linux-musl, powerpc64-unknown-linux-musl-gcc, "", "-static"] | |
| - [powerpc, gcc-powerpc-linux-gnu, "", powerpc-linux-gnu-gcc, "", "-static"] | |
| #[powerpc, "", powerpc-unknown-linux-musl, powerpc-unknown-linux-musl-gcc, "", "-static"] | |
| - [s390x, gcc-s390x-linux-gnu, "", s390x-linux-gnu-gcc, "", "-static"] | |
| #[s390x, "", s390x-ibm-linux-musl, s390x-ibm-linux-musl-gcc, "", "-static"] | |
| #[riscv32, gcc-riscv64-linux-gnu, "", riscv64-linux-gnu-gcc, "-march=rv32gc -mabi=ilp32", "-static"] | |
| - [riscv32, "", riscv32-unknown-linux-musl, riscv32-unknown-linux-musl-gcc, "", "-static"] | |
| - [riscv64, gcc-riscv64-linux-gnu, "", riscv64-linux-gnu-gcc, "", "-static"] | |
| #[riscv64-musl, "", riscv64-unknown-linux-musl, riscv64-unknown-linux-musl-gcc, "", "-static"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install ${{ matrix.target[1] }} | |
| if: matrix.target[1] != '' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ${{ matrix.target[1] }} | |
| - name: Install musl ${{ matrix.target[2] }} toolchain | |
| if: matrix.target[2] != '' | |
| run: | | |
| #LATEST=$(curl -s https://api.github.com/repos/cross-tools/musl-cross/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |
| #MUSL_RELEASE=https://github.com/cross-tools/musl-cross/releases/download/${LATEST}/ | |
| URL=${{ env.MUSL_RELEASE }}${{ matrix.target[2] }}.tar.xz | |
| echo "Downloading musl toolchain from $URL" | |
| wget $URL | |
| tar -xJvf ${{ matrix.target[2] }}.tar.xz | |
| echo "$(pwd)/${{ matrix.target[2] }}/bin" >> $GITHUB_PATH | |
| - name: Clean and build ${{ matrix.target[0] }} | |
| run: | | |
| make clean | |
| make all CC=${{ matrix.target[3] }} CFLAGS='-O2 -Wall ${{ matrix.target[4] }}' LDFLAGS='${{ matrix.target[5] }}' RELEASE=1 | |
| - name: Prepare version | |
| id: prep | |
| run: | | |
| VERSION=$(grep WG_OBFUSCATOR_VERSION wg-obfuscator.h | awk '{print $3}' | sed 's|"||g' | tr -d '\r') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Archive | |
| run: | | |
| mkdir -p tmp | |
| mv ${{ env.IMAGE_NAME }} LICENSE *.md *.conf tmp/ | |
| mv tmp ${{ env.IMAGE_NAME }} | |
| tar -czf ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-linux-${{ matrix.target[0] }}.tar.gz ${{ env.IMAGE_NAME }} | |
| - name: Load Release URL File from release job | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release_url | |
| - name: Get Release File Name & Upload URL | |
| id: get_release_info | |
| run: | | |
| value=`cat release_url.txt` | |
| echo upload_url=$value >> $GITHUB_OUTPUT | |
| - name: Upload to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.get_release_info.outputs.upload_url }} | |
| asset_path: ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-linux-${{ matrix.target[0] }}.tar.gz | |
| asset_name: ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-linux-${{ matrix.target[0] }}.tar.gz | |
| asset_content_type: application/gzip | |
| build-macos-arm64: | |
| needs: create-release | |
| runs-on: macos-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: make clean all | |
| run: make clean all RELEASE=1 | |
| - name: Prepare version | |
| id: prep | |
| run: | | |
| VERSION=$(grep WG_OBFUSCATOR_VERSION wg-obfuscator.h | awk '{print $3}' | sed 's|"||g' | tr -d '\r') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Archive | |
| run: | | |
| mkdir -p tmp | |
| mv ${{ env.IMAGE_NAME }} LICENSE *.md *.conf tmp/ | |
| mv tmp ${{ env.IMAGE_NAME }} | |
| zip -9 -r ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-macos-arm64.zip ${{ env.IMAGE_NAME }} | |
| - name: Load Release URL File from release job | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: release_url | |
| - name: Get Release File Name & Upload URL | |
| id: get_release_info | |
| run: | | |
| value=`cat release_url.txt` | |
| echo upload_url=$value >> $GITHUB_OUTPUT | |
| - name: Upload to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.get_release_info.outputs.upload_url }} | |
| asset_path: ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-macos-arm64.zip | |
| asset_name: ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-macos-arm64.zip | |
| asset_content_type: application/zip | |
| build-macos-x64: | |
| needs: create-release | |
| runs-on: macos-13 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: make clean all | |
| run: make clean all RELEASE=1 | |
| - name: Prepare version | |
| id: prep | |
| run: | | |
| VERSION=$(grep WG_OBFUSCATOR_VERSION wg-obfuscator.h | awk '{print $3}' | sed 's|"||g' | tr -d '\r') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Archive | |
| run: | | |
| mkdir -p tmp | |
| mv ${{ env.IMAGE_NAME }} LICENSE *.md *.conf tmp/ | |
| mv tmp ${{ env.IMAGE_NAME }} | |
| zip -9 -r ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-macos-x64.zip ${{ env.IMAGE_NAME }} | |
| - name: Load Release URL File from release job | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: release_url | |
| - name: Get Release File Name & Upload URL | |
| id: get_release_info | |
| run: | | |
| value=`cat release_url.txt` | |
| echo upload_url=$value >> $GITHUB_OUTPUT | |
| - name: Upload to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.get_release_info.outputs.upload_url }} | |
| asset_path: ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-macos-x64.zip | |
| asset_name: ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-macos-x64.zip | |
| asset_content_type: application/zip | |
| build-windows: | |
| needs: create-release | |
| runs-on: windows-latest | |
| permissions: | |
| contents: write | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - uses: msys2/setup-msys2@v2 | |
| with: | |
| update: true | |
| install: >- | |
| base-devel | |
| gcc | |
| git | |
| zip | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: make clean all | |
| run: make clean all RELEASE=1 | |
| - name: Prepare version | |
| id: prep | |
| run: | | |
| VERSION=$(grep WG_OBFUSCATOR_VERSION wg-obfuscator.h | awk '{print $3}' | sed 's|"||g' | tr -d '\r') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Archive | |
| run: | | |
| mkdir -p tmp | |
| mv ${{ env.IMAGE_NAME }} *.dll LICENSE *.md *.conf tmp/ | |
| mv tmp ${{ env.IMAGE_NAME }} | |
| zip -9 -r ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-windows-x64.zip ${{ env.IMAGE_NAME }} | |
| - name: Load Release URL File from release job | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: release_url | |
| - name: Get Release File Name & Upload URL | |
| id: get_release_info | |
| run: | | |
| value=`cat release_url.txt` | |
| echo upload_url=$value >> $GITHUB_OUTPUT | |
| - name: Upload to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.get_release_info.outputs.upload_url }} | |
| asset_path: ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-windows-x64.zip | |
| asset_name: ${{ env.IMAGE_NAME }}-v${{ steps.prep.outputs.version }}-windows-x64.zip | |
| asset_content_type: application/zip | |
| push-to-docker-hub: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Get version | |
| id: prep | |
| run: | | |
| VERSION=$(grep WG_OBFUSCATOR_VERSION wg-obfuscator.h | awk '{print $3}' | sed 's|"||g' | tr -d '\r') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Build and push multiarch image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| tags: | | |
| clustermeerkat/${{ env.IMAGE_NAME }}:latest | |
| clustermeerkat/${{ env.IMAGE_NAME }}:${{ steps.prep.outputs.version }} | |
| platforms: ${{ env.PLATFORMS }} | |
| context: . |