Skip to content

Commit

Permalink
Merge pull request #1766 from picoe/curtis/use-release-to-publish
Browse files Browse the repository at this point in the history
Update build.yml to trigger on a published release
  • Loading branch information
cwensley authored Aug 6, 2020
2 parents 0a7b326 + 837f2d1 commit 47271c1
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
branches: [ develop ]
pull_request:
branches: [ develop ]
create:
tags: [ '*' ]
release:
types: [ published ]

env:
DotNetVersion: "3.1.301"
Expand Down Expand Up @@ -116,26 +116,21 @@ jobs:
name: log
path: artifacts/log/**/*

create-release:
update-release:
needs: [ build-windows, build-mac ]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
if: (github.event_name == 'release' && github.event.action == 'published' && startsWith(github.ref, 'refs/tags/'))
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

- name: Create release
id: create_release
uses: actions/create-release@v1
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.get_version.outputs.VERSION }}
draft: true
prerelease: false


- name: Download extension artifacts
uses: actions/download-artifact@v2
with:
Expand All @@ -146,7 +141,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: Eto.Addin.VisualStudio-${{ steps.get_version.outputs.VERSION }}.vsix
asset_name: Eto.Addin.VisualStudio-${{ steps.get_version.outputs.VERSION }}.vsix
asset_content_type: application/octet-stream
Expand All @@ -156,15 +151,15 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: Eto.Addin.MonoDevelop-${{ steps.get_version.outputs.VERSION }}.mpack
asset_name: Eto.Addin.MonoDevelop-${{ steps.get_version.outputs.VERSION }}.mpack
asset_content_type: application/octet-stream

publish:
needs: [ build-windows, build-mac ]
runs-on: ubuntu-latest
if: (github.event_name == 'push' && github.ref == 'refs/heads/develop') || startsWith(github.ref, 'refs/tags/')
if: (github.event_name == 'push' && github.ref == 'refs/heads/develop') || (github.event_name == 'release' && github.event.action == 'published' && startsWith(github.ref, 'refs/tags/'))
steps:
- name: Download nuget artifacts
uses: actions/download-artifact@v2
Expand All @@ -175,5 +170,5 @@ jobs:
run: dotnet nuget push '*.nupkg' --skip-duplicate -s https://www.myget.org/F/eto/api/v2/package -k ${{secrets.MYGET_API_KEY}}

- name: Push packages to nuget.org
if: startsWith(github.ref, 'refs/tags/')
if: (github.event_name == 'release' && github.event.action == 'published' && startsWith(github.ref, 'refs/tags/'))
run: dotnet nuget push '*.nupkg' --skip-duplicate -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}

0 comments on commit 47271c1

Please sign in to comment.