name: Release on: push: tags: - "v*.*.*" permissions: contents: write jobs: build: runs-on: ubuntu-latest env: CGO_ENABLED: 1 steps: - name: Checkout codebase uses: actions/checkout@v3 with: fetch-depth: 0 - name: Setup NodeJS uses: actions/setup-node@v3 with: node-version: '18.x' cache: 'yarn' cache-dependency-path: frontend - name: Build Frontend run: | make assets - name: Build Yggdrasil Server uses: crazy-max/ghaction-xgo@v2 with: xgo_version: latest go_version: 1.24 dest: build prefix: yggdrasil targets: windows/amd64,linux/amd64,linux/arm64,darwin/amd64,darwin/arm64 v: true x: false race: false ldflags: -s -w -buildid= tags: nomsgpack sqlite mysql trimpath: true - name: Create ZIP archive if: startsWith(github.ref, 'refs/tags/') run: | cp -v ./config_example.ini ./assets ./build/ || exit 1 pushd build || exit 1 ls -1 yggdrasil-* | while read LINE; do PREFIX="${LINE%.*}" SUFFIX="$(echo "$LINE" | grep -osE '\.\w+' || printf '')" cp -v "$LINE" "yggdrasil$SUFFIX" FILE="../$PREFIX.zip" zip -9v "$FILE" "yggdrasil$SUFFIX" *.ini assets 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" done popd || exit 1 - name: Upload files to GitHub release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: prerelease: true body: For test only name: ${{ github.ref_name }} Pre Release files: yggdrasil*.zip* - name: Set up QEMU uses: docker/setup-qemu-action@v2 if: startsWith(github.ref, 'refs/tags/') - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 if: startsWith(github.ref, 'refs/tags/') - name: Login to Docker Hub uses: docker/login-action@v2 if: startsWith(github.ref, 'refs/tags/') with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v3 if: startsWith(github.ref, 'refs/tags/') with: context: . push: true platforms: linux/amd64,linux/arm64 tags: gardel/yggdrasil-go:latest, gardel/yggdrasil-go:${{ github.ref_name }}