Skip to content

Commit 1cbd57d

Browse files
committed
Closing the loop on the release pipeline
1 parent a9a3482 commit 1cbd57d

8 files changed

Lines changed: 504 additions & 12 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: "Close Issue"
2+
description: "Closes an issue with a message"
3+
inputs:
4+
token:
5+
description: "GitHub access token"
6+
required: true
7+
default: ""
8+
message:
9+
description: "Message on closing"
10+
required: true
11+
default: "Issue has been closed automatically"
12+
runs:
13+
using: "node12"
14+
main: "dist/index.js"

.github/actions/close-issue/package-lock.json

Lines changed: 394 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "close-issue",
3+
"version": "1.0.0",
4+
"description": "Closes an issue with a message",
5+
"private": true,
6+
"main": "index.js",
7+
"scripts": {
8+
"build": "tsc"
9+
},
10+
"keywords": [],
11+
"author": "Aaron Powell",
12+
"license": "MIT",
13+
"dependencies": {
14+
"@actions/core": "^1.2.3",
15+
"@actions/github": "^2.1.1"
16+
},
17+
"devDependencies": {
18+
"typescript": "^3.8.3"
19+
}
20+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import * as core from "@actions/core";
2+
import * as github from "@actions/github";
3+
4+
async function run() {
5+
const token = core.getInput("token");
6+
7+
const octokit = new github.GitHub(token);
8+
const context = github.context;
9+
10+
if (!context.payload.issue) {
11+
throw new Error("This should not happen");
12+
}
13+
14+
await octokit.issues.createComment({
15+
...context.repo,
16+
issue_number: context.payload.issue.number,
17+
body: core.getInput("message")
18+
});
19+
20+
await octokit.issues.update({
21+
...context.repo,
22+
issue_number: context.payload.issue.number,
23+
state: "closed"
24+
});
25+
}
26+
27+
run();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "commonjs",
5+
"strict": true,
6+
"esModuleInterop": true,
7+
"forceConsistentCasingInFileNames": true,
8+
"outDir": "dist"
9+
}
10+
}

.github/workflows/release-package.yml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ jobs:
6464
version=$(cat version.txt)
6565
echo "::set-env name=package_version::$version"
6666
67-
# - name: Setup Dotnet ${{ env.DOTNET_VERSION }}
68-
# uses: actions/setup-dotnet@v1
69-
# if: steps.check-issue.outputs.exists == 'true'
70-
# with:
71-
# dotnet-version: ${{ env.DOTNET_VERSION }}
72-
73-
# - name: Push NuGet Package
74-
# if: steps.check-issue.outputs.exists == 'true'
75-
# working-directory: ${{ env.OUTPUT_PATH }}
76-
# run: |
77-
# dotnet nuget push FSharp.CosmosDb.${{ env.package_version }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source ${{ env.NUGET_SOURCE }}
78-
# dotnet nuget push FSharp.CosmosDb.Analyzer.${{ env.package_version }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source ${{ env.NUGET_SOURCE }}
67+
- name: Setup Dotnet ${{ env.DOTNET_VERSION }}
68+
uses: actions/setup-dotnet@v1
69+
if: steps.check-issue.outputs.exists == 'true'
70+
with:
71+
dotnet-version: ${{ env.DOTNET_VERSION }}
72+
73+
- name: Push NuGet Package
74+
if: steps.check-issue.outputs.exists == 'true'
75+
working-directory: ${{ env.OUTPUT_PATH }}
76+
run: |
77+
dotnet nuget push FSharp.CosmosDb.${{ env.package_version }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source ${{ env.NUGET_SOURCE }}
78+
dotnet nuget push FSharp.CosmosDb.Analyzer.${{ env.package_version }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source ${{ env.NUGET_SOURCE }}
7979
8080
- name: Get Action sha
8181
if: steps.check-issue.outputs.exists == 'true'
@@ -99,3 +99,20 @@ jobs:
9999
sha: ${{ env.action_sha }}
100100
version: ${{ env.package_version }}
101101
path: ${{ env.OUTPUT_PATH }}
102+
103+
- name: Building Action
104+
run: npm i && npm run build
105+
if: steps.check-issue.outputs.exists == 'true'
106+
working-directory: ./.github/actions/close-issue
107+
108+
- name: Close issue
109+
uses: ./.github/actions/close-issue
110+
if: steps.check-issue.outputs.exists == 'true'
111+
with:
112+
token: ${{ secrets.GITHUB_TOKEN }}
113+
message: |
114+
The release has been approved and has been
115+
116+
* Deployed to NuGet
117+
* Created as a Release on the repo
118+
* Commit has been tagged

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog for `FSharp.CosmosDb`
22

3+
## [0.1.1] - 2020-03-13
4+
5+
### Changed
6+
7+
- CI/CD pipeline working
8+
39
## [0.1.0] - 2020-03-12
410

511
Initial Release :tada:

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# FSharp.CosmosDb 🌍
22

3+
![Latest Build](https://github.com/aaronpowell/FSharp.CosmosDb/workflows/Build%20release%20candidate/badge.svg) ![Latest Release](https://github.com/aaronpowell/FSharp.CosmosDb/workflows/Publish%20Release/badge.svg) [![NuGet Badge - FSharp.CosmosDb](https://buildstats.info/nuget/FSharp.CosmosDb)](https://www.nuget.org/packages/FSharp.CosmosDb) [![The MIT License](https://img.shields.io/badge/license-MIT-orange.svg?color=blue&style=flat-square)](http://opensource.org/licenses/MIT)
4+
35
This project is a wrapper around the [Cosmos DB](https://docs.microsoft.com/azure/cosmos-db/introduction?WT.mc_id=fsharpcosmosdb-github-aapowell) [v4 .NET SDK](https://docs.microsoft.com/azure/cosmos-db/create-sql-api-dotnet-v4?WT.mc_id=fsharpcosmosdb-github-aapowell) to make it a bit more friendly to the F# language.
46

57
## Install
@@ -52,6 +54,8 @@ let main argv =
5254

5355
# FSharp.CosmosDb.Analyzer 💡
5456

57+
[![NuGet Badge - FSharp.CosmosDb](https://buildstats.info/nuget/FSharp.CosmosDb)](https://www.nuget.org/packages/FSharp.CosmosDb)
58+
5559
Also part of this repo is a [F# Analyzer](https://github.com/ionide/FSharp.Analyzers.SDK) for use from the CLI or in Ionide.
5660

5761
![Analyzer in action](/docs/images/cosmos-analyzer-usage.gif)

0 commit comments

Comments
 (0)