Publish Release Build #53
Workflow file for this run
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: Publish Release Build | |
on: | |
release: | |
types: [published] | |
env: | |
BRANCH_REFERENCE: refs/heads/master | |
DEPLOY_USER: "ExtendedXmlSerializer's GitHub Action Automation Agent" | |
DEPLOY_EMAIL: "[email protected]" | |
DEPLOY_COMMIT_MESSAGE: Generated CHANGELOG.md | |
DEPLOY_ACCOUNT: ExtendedXmlSerializer | |
DEPLOY_SLUG: extendedxmlserializer | |
DEPLOY_BRANCH: master | |
jobs: | |
information: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Output Information | |
run: | | |
echo "****************************************************" | |
echo "Event name: ${{ github.event_name }}" | |
echo "Action type: ${{ github.event.action }}" | |
echo "****************************************************" | |
generate_and_save: | |
runs-on: ubuntu-latest | |
needs: [information] | |
steps: | |
- id: generate | |
name: Generate CHANGELOG | |
uses: dragonspark/action-changelog-dawg@master | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload CHANGELOG | |
uses: actions/upload-artifact@v1 | |
with: | |
name: store | |
path: '${{ steps.generate.outputs.filename }}' | |
load_and_push: | |
runs-on: ubuntu-latest | |
needs: [generate_and_save] | |
steps: | |
- uses: actions/checkout@master | |
with: | |
ref: ${{ env.BRANCH_REFERENCE }} | |
- name: Download the CHANGELOG | |
uses: actions/download-artifact@v1 | |
with: | |
name: store | |
path: ./ | |
- name: Get base branch | |
id: vars | |
run: | | |
base_ref=${{ env.BRANCH_REFERENCE }} | |
echo ::set-output name=base_branch::${base_ref#refs/*/} | |
- name: Create Pull Request for CHANGELOG | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: ${{ env.DEPLOY_COMMIT_MESSAGE }} | |
author: '${{ env.DEPLOY_USER }} <${{ env.DEPLOY_EMAIL }}>' | |
title: '[Automated] ${{ env.DEPLOY_COMMIT_MESSAGE }}' | |
body: | | |
Automated Pull Request | |
- Event Name: ${{ github.event_name }} | |
- Event Type: ${{ github.event.action }} | |
- Proudly Auto-generated using [create-pull-request][1] | |
[1]: https://github.com/peter-evans/create-pull-request | |
labels: automerge | |
base: ${{ steps.vars.outputs.base_branch }} | |
branch: automated/changelog | |
build: | |
needs: [load_and_push] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Apply and Update Build Versioning | |
run: | | |
$current = [System.Management.Automation.SemanticVersion]"${{ github.event.release.tag_name }}".TrimStart("vV") | |
$token = ConvertTo-SecureString "${{ secrets.API_APPVEYOR_TOKEN }}" -AsPlainText -Force | |
$s = Invoke-RestMethod "https://ci.appveyor.com/api/projects/$env:DEPLOY_ACCOUNT/$env:DEPLOY_SLUG/settings" -Authentication Bearer -Token $token | |
$s.settings.versionFormat = "$current.{build}" | |
$s.settings.nextBuildNumber = "0" | |
Invoke-RestMethod 'https://ci.appveyor.com/api/projects' -Method Put -Authentication Bearer -Token $token -Body ($s.settings | ConvertTo-Json -Depth 10) -ContentType "application/json" | |
shell: pwsh | |
- name: Initiate Build Process | |
run: | | |
$headers = @{ | |
"Authorization" = "Bearer ${{ secrets.API_APPVEYOR_TOKEN }}" | |
"Content-type" = "application/json" | |
} | |
$body = @{ | |
accountName = $env:DEPLOY_ACCOUNT | |
projectSlug = $env:DEPLOY_SLUG | |
branch = "${{ github.event.release.tag_name }}" | |
commitId = "${{ github.event.release.tag_name }}" | |
environmentVariables = @{ | |
APPVEYOR_REPO_COMMIT_AUTHOR = $env:DEPLOY_USER | |
APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL = $env:DEPLOY_EMAIL | |
APPVEYOR_REPO_TAG = $true | |
APPVEYOR_REPO_TAG_NAME = "${{ github.event.release.tag_name }}" | |
} | |
} | ConvertTo-Json | |
Invoke-RestMethod 'https://ci.appveyor.com/api/builds' -Method POST -Headers $headers -Body $body | |
shell: pwsh |