name: CI on: push: branches: [ master ] tags: "[0-9]+.[0-9]+.[0-9]+" pull_request: branches: [ master ] workflow_dispatch: jobs: # build: # name: Build and Test # runs-on: ubuntu-latest # steps: # - name: Checkout # uses: actions/checkout@v2 # with: # fetch-depth: 0 # - name: Set Environment Variables # run: | # echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV # echo "REVISION=$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)" >> $GITHUB_ENV # echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV # echo "VERSION=$(git describe --tags --abbrev=0).$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV # - name: Web # run: ./bin/build --web-only # - name: Dotnet # run: ./bin/build --dotnet-only --version ${{ env.VERSION }} # - name: Upload Static Web Content # if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') # uses: actions/upload-artifact@v2 # with: # name: web-${{ env.VERSION }} # path: src/web/build # publish: # name: Build Platform-Specific Binaries # runs-on: ubuntu-latest # needs: build # if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') # strategy: # matrix: # runtime: ["win-x64", "linux-x64", "linux-musl-x64", "linux-arm", "linux-arm64", "osx-x64"] # steps: # - name: Checkout # uses: actions/checkout@v2 # with: # fetch-depth: 0 # - name: Set Environment Variables # run: | # echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV # echo "REVISION=$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)" >> $GITHUB_ENV # echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV # echo "VERSION=$(git describe --tags --abbrev=0).$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV # - name: Download Static Web Content # uses: actions/download-artifact@v2 # with: # name: web-${{ env.VERSION }} # path: src/slskd/wwwroot # - name: Build ${{ matrix.runtime }} # run: bin/publish --no-prebuild --runtime ${{ matrix.runtime }} --version ${{ env.VERSION }} # - name: Upload Binaries # uses: actions/upload-artifact@v2 # with: # name: slskd-${{ env.VERSION }}-${{ matrix.runtime }} # path: dist/${{ matrix.runtime }} docker: name: Build Docker Image runs-on: ubuntu-latest #needs: build if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set Environment Variables run: | echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV echo "REVISION=$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)" >> $GITHUB_ENV echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV echo "VERSION=$(git describe --tags --abbrev=0).$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Cache Docker layers uses: actions/cache@v2 with: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx- - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Build and push uses: docker/build-push-action@v2 with: platforms: linux/amd64,linux/arm64,linux/arm push: true build-args: | VERSION=${{ env.VERSION }} tags: | slskd/slskd:${{ env.VERSION }} slskd/slskd:canary cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache # - name: Build # run: docker build -t slskd/slskd:${{ env.VERSION }} --build-arg VERSION=${{ env.VERSION }} . # - name: Tag (Canary) # run: docker tag slskd/slskd:${{ env.VERSION }} slskd/slskd:canary # - name: Tag (Release) # if: startsWith(github.ref, 'refs/tags/') # run: | # docker tag slskd/slskd:${{ env.VERSION }} slskd/slskd:${{ env.LATEST_TAG }} # docker tag slskd/slskd:${{ env.VERSION }} slskd/slskd:latest # - name: Login # run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin # - name: Push Image # run: docker push slskd/slskd:${{ env.VERSION }} # - name: Push Tag (Canary) # run: docker push slskd/slskd:canary # - name: Push Tag (Release) # if: startsWith(github.ref, 'refs/tags/') # run: | # docker push slskd/slskd:${{ env.LATEST_TAG }} # docker push slskd/slskd:latest # release: # name: Create Release # runs-on: ubuntu-latest # needs: [publish, docker] # if: startsWith(github.ref, 'refs/tags/') # steps: # - name: Checkout # uses: actions/checkout@v2 # with: # fetch-depth: 0 # - name: Set Environment Variables # run: | # echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV # echo "REVISION=$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)" >> $GITHUB_ENV # echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV # echo "VERSION=$(git describe --tags --abbrev=0).$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV # - name: Download win-x64 Binaries # uses: actions/download-artifact@v2 # with: # name: slskd-${{ env.VERSION }}-win-x64 # path: dist/win-x64 # - name: Zip win-x64 Binaries # run: | # cd dist/win-x64 # zip -r ../../slskd-${{ env.LATEST_TAG }}-win-x64.zip . # - name: Download linux-x64 Binaries # uses: actions/download-artifact@v2 # with: # name: slskd-${{ env.VERSION }}-linux-x64 # path: dist/linux-x64 # - name: Zip linux-x64 Binaries # run: | # cd dist/linux-x64 # zip -r ../../slskd-${{ env.LATEST_TAG }}-linux-x64.zip . # - name: Download linux-musl-x64 Binaries # uses: actions/download-artifact@v2 # with: # name: slskd-${{ env.VERSION }}-linux-musl-x64 # path: dist/linux-musl-x64 # - name: Zip linux-musl-x64 Binaries # run: | # cd dist/linux-musl-x64 # zip -r ../../slskd-${{ env.LATEST_TAG }}-linux-musl-x64.zip . # - name: Download linux-arm Binaries # uses: actions/download-artifact@v2 # with: # name: slskd-${{ env.VERSION }}-linux-arm # path: dist/linux-arm # - name: Zip linux-arm Binaries # run: | # cd dist/linux-arm # zip -r ../../slskd-${{ env.LATEST_TAG }}-linux-arm.zip . # - name: Download linux-arm Binaries # uses: actions/download-artifact@v2 # with: # name: slskd-${{ env.VERSION }}-linux-arm64 # path: dist/linux-arm64 # - name: Zip linux-arm64 Binaries # run: | # cd dist/linux-arm64 # zip -r ../../slskd-${{ env.LATEST_TAG }}-linux-arm64.zip . # - name: Download osx-x64 Binaries # uses: actions/download-artifact@v2 # with: # name: slskd-${{ env.VERSION }}-osx-x64 # path: dist/osx-x64 # - name: Zip osx-x64 Binaries # run: | # cd dist/osx-x64 # zip -r ../../slskd-${{ env.LATEST_TAG }}-osx-x64.zip . # - name: Build Changelog # id: build_changelog # uses: mikepenz/release-changelog-builder-action@v1.4.0 # with: # configuration: .github/configuration/changelog.json # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # - name: Create Release # uses: softprops/action-gh-release@v1 # if: startsWith(github.ref, 'refs/tags/') # with: # body: ${{ steps.build_changelog.outputs.changelog }} # files: | # slskd-${{ env.LATEST_TAG }}-win-x64.zip # slskd-${{ env.LATEST_TAG }}-linux-x64.zip # slskd-${{ env.LATEST_TAG }}-linux-musl-x64.zip # slskd-${{ env.LATEST_TAG }}-linux-arm.zip # slskd-${{ env.LATEST_TAG }}-linux-arm64.zip # slskd-${{ env.LATEST_TAG }}-osx-x64.zip # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}