fix sendblocks spam; fix faucet crash #83
This file contains 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: Staging-Pull-Request-Merged | |
on: | |
pull_request: | |
types: [closed] | |
branches: [ "staging" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check incomming branch | |
id: set_branch | |
run: | | |
branch="${{ github.head_ref }}" | |
branch_short=${branch%%/*} | |
if [ "$branch_short" == "patch" ]; then | |
echo "::set-output name=IS_PATCH::$(echo true)" | |
else | |
echo "::set-output name=IS_PATCH::$(echo false)" | |
fi | |
if [ "$branch_short" == "feature" ]; then | |
echo "::set-output name=IS_FEATURE::$(echo true)" | |
else | |
echo "::set-output name=IS_FEATURE::$(echo false)" | |
fi | |
if: ${{ github.event.pull_request.merged == true }} | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: staging | |
token: ${{ secrets.GDAT }} | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 6.0.x | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Restore dependencies | |
run: | | |
dotnet restore | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Build | |
run: | | |
dotnet build --no-restore | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Increment patch version | |
uses: fjogeleit/http-request-action@v1 | |
with: | |
url: 'https://releases.discreet.net/versions/daemon/patch' | |
method: 'POST' | |
customHeaders: '{ "x-daemon-version-key": "${{ secrets.DAEMON_VERSION_KEY }}" }' | |
if: ${{ github.event.pull_request.merged == true && contains(steps.set_branch.outputs.IS_PATCH, 'true') }} | |
- name: Increment feature version | |
uses: fjogeleit/http-request-action@v1 | |
with: | |
url: 'https://releases.discreet.net/versions/daemon/feature' | |
method: 'POST' | |
customHeaders: '{ "x-daemon-version-key": "${{ secrets.DAEMON_VERSION_KEY }}" }' | |
if: ${{ github.event.pull_request.merged == true && contains(steps.set_branch.outputs.IS_FEATURE, 'true') }} | |
- name: Fetch preview version | |
id: versionResponse | |
uses: fjogeleit/http-request-action@v1 | |
with: | |
url: 'https://releases.discreet.net/versions/daemon/preview' | |
method: 'GET' | |
customHeaders: '{ "x-daemon-version-key": "${{ secrets.DAEMON_VERSION_KEY }}" }' | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Prepare tag name | |
id: create_tag_name | |
run: echo "::set-output name=TAG_NAME::$( echo ${{ steps.versionResponse.outputs.response }} | tr -d '"')" | |
shell: bash | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Publish [WIN-x64] | |
run: | | |
dotnet publish --configuration Release --runtime win-x64 --framework net6.0 -p:ReadyToRun=true -p:Version=${{ steps.versionResponse.outputs.response }} | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Install zip | |
uses: montudor/action-zip@v1 | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Zip [WIN-X64] | |
run: | | |
cd Discreet/bin/Release/net6.0/win-x64/publish | |
zip -qq -r ../win-x64.zip . | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Publish [LINUX-x64] | |
run: | | |
dotnet publish --configuration Release --runtime linux-x64 --framework net6.0 -p:Version=${{ steps.versionResponse.outputs.response }} | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Tar bz2 [LINUX-x64] | |
run: | | |
cd Discreet/bin/Release/net6.0/linux-x64/publish | |
tar -cjvf ../linux-x64.tar.bz2 * | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Create preview release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
id: create_release | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "staging-preview" | |
prerelease: true | |
title: v${{ steps.create_tag_name.outputs.TAG_NAME }}-preview | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Upload win archive to the release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: Discreet/bin/Release/net6.0/win-x64/win-x64.zip | |
asset_name: win-x64.zip | |
asset_content_type: application/zip | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Upload linux tar to the release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: Discreet/bin/Release/net6.0/linux-x64/linux-x64.tar.bz2 | |
asset_name: linux-x64.tar.bz2 | |
asset_content_type: application/bzip2 | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Edit version in csproj | |
run: sed -i 's/<Version>.*<\/Version>/<Version>${{ steps.create_tag_name.outputs.TAG_NAME }}<\/Version>/g' Discreet/Discreet.csproj | |
shell: bash | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Echo csproj | |
run: cat Discreet/Discreet.csproj | |
shell: bash | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Push csproj changes | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add Discreet/Discreet.csproj | |
git commit -m "🖉 Edited version in Discreet.csproj" | |
git push | |
shell: bash | |
if: ${{ github.event.pull_request.merged == true }} | |
- name: Schedule new package builds | |
uses: fjogeleit/http-request-action@v1 | |
with: | |
url: 'https://releases.discreet.net/build/daemon/preview' | |
method: 'POST' | |
customHeaders: '{ "x-daemon-version-key": "${{ secrets.DAEMON_VERSION_KEY }}", "x-syk": "${{ secrets.SYK }}" }' |