Skip to content

Commit

Permalink
Merge pull request #48 from HenrikWM/f-create-release-with-tags
Browse files Browse the repository at this point in the history
Create GitHub-releases with Git tags
  • Loading branch information
HenrikWM committed Jan 18, 2021
2 parents 98e8083 + d4e58d9 commit 30de79b
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 33 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,31 @@ on:
pull_request:
branches: [main]

env:
DOTNET_VERSION: 3.1.301

jobs:
build:
runs-on: ubuntu-latest

steps:
# Job setup
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.301
dotnet-version: ${{ env.DOTNET_VERSION }}

# Build, test and pack/publish
- name: Build and Test
run: ./Build.ps1
shell: pwsh

# Upload artifacts
- name: Artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
name: artifacts.zip
path: artifacts/**/*
67 changes: 67 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Create release

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

env:
DOTNET_VERSION: 3.1.301

jobs:
build:
runs-on: ubuntu-latest

steps:
# Job setup
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

# Build, test and pack/publish
- name: Build and Test
run: ./Build.ps1
shell: pwsh

# Upload artifacts
- name: Artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts.zip
path: artifacts/**/*

# Create release with published artifact
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: ${{ contains(github.ref, '-') }} # Prerelease if vX.Y.Z-<any-suffix>
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./artifacts.zip
asset_name: artifacts.zip
asset_content_type: application/zip

# NuGet publish
- name: Push to NuGet
env:
NUGET_URL: https://api.nuget.org/v3/index.json
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: ./Push.ps1
shell: pwsh
30 changes: 0 additions & 30 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Deterministic>true</Deterministic>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
<Version>1.3.0</Version>
<Version>1.4.0</Version>
<RepositoryUrl>https://github.com/HenrikWM/anonymous-tokens</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<LangVersion>latest</LangVersion>
Expand Down

0 comments on commit 30de79b

Please sign in to comment.