-
-
Notifications
You must be signed in to change notification settings - Fork 312
90 lines (78 loc) · 3.02 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Release Pipeline
run-name: Publish ${{ inputs.package_id }} ${{ inputs.package_version }}
on:
workflow_dispatch:
inputs:
package_id:
description: "Package"
type: choice
default: 'ShopifySharp'
options:
- 'ShopifySharp'
- 'ShopifySharp.Extensions.DependencyInjection'
package_version:
description: "New package version"
type: string
required: true
jobs:
publish:
name: "Publish release packages"
runs-on: ubuntu-22.04
environment: "Release deployment environment"
steps:
- name: Install fish
run: |
sudo apt-add-repository ppa:fish-shell/release-3 \
&& sudo apt-get -qq update \
&& sudo apt-get -qq install fish parallel
- name: Setup dotnet
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
8.0.x
7.0.x
- name: Install dotnet tools
run: |
dotnet tool install -g dotnet-setversion
- name: Clone repository
uses: actions/checkout@v3
- name: Bump package version
run: setversion -p "${{ inputs.package_version }}" "${{inputs.package_id }}/${{ inputs.package_id }}.csproj"
- name: Build and pack
run: fish .github/scripts/build.fish
shell: bash
env:
GITHUB_RUN_NUMBER: "${{ github.run_number }}"
ARTIFACT_DIR: "./artifacts"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
if-no-files-found: error
path: |
./artifacts/ShopifySharp.${{ inputs.package_version }}.nupkg
./artifacts/ShopifySharp.${{ inputs.package_version }}.snupkg
./artifacts/ShopifySharp.Extensions.DependencyInjection.${{ inputs.package_version }}.nupkg
./artifacts/ShopifySharp.Extensions.DependencyInjection.${{ inputs.package_version }}.snupkg
- name: Commit package version change
uses: EndBug/add-and-commit@v9
with:
add: "${{ inputs.package_id }}/${{ inputs.package_id }}.csproj"
commit: --signoff
message: "Bump version to ${{ inputs.package_version }}"
pathspec_error_handling: exitAtEnd
default_author: github_actions
push: true
- name: Publish ${{ inputs.package_id }} package to Nuget
run: dotnet nuget push --skip-duplicate -k ${{ secrets.NUGET_TOKEN }} -s "https://api.nuget.org/v3/index.json" ./artifacts/${{ inputs.package_id }}.${{ inputs.package_version }}.nupkg
- name: Create Github release for ${{ inputs.package_id }}
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ inputs.package_id }}/${{ inputs.package_version }}"
prerelease: false
draft: true
title: "${{ inputs.package_id }} ${{ inputs.package_version }}"
files: |
./artifacts/${{ inputs.package_id }}.${{ inputs.package_version }}.nupkg
./artifacts/${{ inputs.package_id }}.${{ inputs.package_version }}.snupkg