name: Release on: release: types: [published] jobs: build: runs-on: ubuntu-latest strategy: matrix: # Include amd64 on all platforms. goos: [windows, linux, darwin] goarch: [amd64, 386] exclude: - goarch: 386 goos: darwin include: # BEGIN Linux ARM 5 6 7 - goos: linux goarch: arm-7 - goos: linux goarch: arm-6 - goos: linux goarch: arm-5 # END Linux ARM 5 6 7 # BEGIN Other architectures - goos: darwin goarch: arm64 - goos: linux goarch: arm64 # BEGIN MIPS - goos: linux goarch: mips64 - goos: linux goarch: mips64le - goos: linux goarch: mipsle - goos: linux goarch: mips # END MIPS fail-fast: false env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Show workflow information run: | echo "GOOS: $GOOS, GOARCH: $GOARCH" - name: Build uses: crazy-max/ghaction-xgo@v2 with: xgo_version: latest go_version: 1.19 dest: build prefix: sonic targets: ${{matrix.goos}}/${{matrix.goarch}} v: true x: false race: false ldflags: -s -w buildmode: default trimpath: true - name: Rename executable file run: | cd ./build || exit 1 mv sonic-$GOOS-$GOARCH* sonic - name: Rename Windows ecutable file if: matrix.goos == 'windows' run: | cd ./build || exit 1 mv sonic sonic.exe - name: Prepare package run: | cp -rv ./conf ./build cp -rv ./resources ./build - name: Prepare package for Linux if: matrix.goos == 'linux' run: cp -rv ./scripts/release/systemd ./build/ - name: Create ZIP archive run: | pushd build || exit 1 zip -9vr ../sonic-$GOOS-$GOARCH.zip . popd || exit 1 FILE=./sonic-$GOOS-$GOARCH.zip DGST=$FILE.dgst openssl dgst -md5 $FILE | sed 's/([^)]*)//g' >>$DGST openssl dgst -sha1 $FILE | sed 's/([^)]*)//g' >>$DGST openssl dgst -sha256 $FILE | sed 's/([^)]*)//g' >>$DGST openssl dgst -sha512 $FILE | sed 's/([^)]*)//g' >>$DGST - name: Upload ZIP file to Artifacts uses: actions/upload-artifact@v3 with: name: sonic-${{matrix.goos}}-${{matrix.goarch}}.zip path: sonic-${{matrix.goos}}-${{matrix.goarch}}.zip - name: Upload files to GitHub release uses: svenstaro/upload-release-action@v2 if: github.event_name == 'release' with: repo_token: ${{ secrets.GITHUB_TOKEN }} file_glob: true file: ./sonic-${{matrix.goos}}-${{matrix.goarch}}.zip* tag: ${{ github.ref }}