Skip to content

Commit d36b5cf

Browse files
Changed project version to 0.0.1 and added release logic to action.
1 parent c4bb234 commit d36b5cf

File tree

2 files changed

+42
-6
lines changed

2 files changed

+42
-6
lines changed

.github/workflows/release.yml

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: Build and Package All Runtimes
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version tag (e.g. v1.0.0)'
8+
required: true
9+
default: 'v1.0.0'
510
push:
611
tags:
712
- 'v*'
@@ -11,9 +16,9 @@ jobs:
1116
runs-on: ubuntu-latest
1217
timeout-minutes: 30
1318
env:
14-
GITHUB_ACTIONS: true
1519
FRAMEWORK: net8.0
1620
PROJECT: ConvertApi.Cli/ConvertApi.Cli.csproj
21+
TAG_NAME: ${{ github.ref_name }}
1722

1823
strategy:
1924
matrix:
@@ -43,9 +48,39 @@ jobs:
4348
/p:DebugType=none \
4449
/p:DebugSymbols=false
4550
46-
- name: Upload artifact for ${{ matrix.runtime }}
47-
uses: actions/upload-artifact@v3
51+
# - name: Upload artifact for ${{ matrix.runtime }}
52+
# uses: actions/upload-artifact@v3
53+
# with:
54+
# name: convertApi-cli-${{ matrix.runtime }}
55+
# path: ConvertApi.Cli/bin/Release/${{ env.FRAMEWORK }}/${{ matrix.runtime }}/publish
56+
# retention-days: 1
57+
58+
# Use a step that archives the published files. This ensures we upload a zip asset.
59+
- name: Zip package for ${{ matrix.runtime }}
60+
run: |
61+
cd ConvertApi.Cli/bin/Release/${{ env.FRAMEWORK }}/${{ matrix.runtime }}/publish
62+
zip -r ../../../../../convertApi-cli-${{ matrix.runtime }}.zip ./*
63+
64+
# Create or update the release only once at first matrix job (not on each matrix job).
65+
- name: Create Release
66+
if: ${{ matrix.runtime == 'win-x64' }}
67+
id: create_release
68+
uses: actions/create-release@v1
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
with:
72+
tag_name: ${{ env.TAG_NAME }}
73+
release_name: ${{ env.TAG_NAME }}
74+
draft: false
75+
prerelease: false
76+
77+
# Upload each runtime's asset to the newly created release.
78+
- name: Upload Release Asset
79+
uses: actions/upload-release-asset@v1
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4882
with:
49-
name: convertApi-cli-${{ matrix.runtime }}
50-
path: ConvertApi.Cli/bin/Release/${{ env.FRAMEWORK }}/${{ matrix.runtime }}/publish
51-
retention-days: 1
83+
upload_url: ${{ steps.create_release.outputs.upload_url }}
84+
asset_path: ./convertApi-cli-${{ matrix.runtime }}.zip
85+
asset_name: convertApi-cli-${{ matrix.runtime }}.zip
86+
asset_content_type: application/zip

ConvertApi.Cli/ConvertApi.Cli.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<Description>convertapi-cli</Description>
1717
<Copyright>ConvertAPI</Copyright>
1818
<Company>ConvertAPI</Company>
19+
<Version>0.0.1</Version>
1920
</PropertyGroup>
2021

2122
<ItemGroup>

0 commit comments

Comments
 (0)