Skip to content

Commit

Permalink
Merge branch 'main' into 1.106.0-release
Browse files Browse the repository at this point in the history
  • Loading branch information
confused-Techie authored Aug 20, 2023
2 parents 1bbd81e + 60620b5 commit 7882add
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/auto_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Chocolatey Publish Pulsar Package

on:
workflow_dispatch:

jobs:
publish:
runs-on: windows-latest

steps:
- name: Checkout Latest Code
uses: actions/checkout@v3

- name: Build Package
run: |
cd ./pulsar
choco pack
- name: Publish New Version
run: |
$fileName = ( Get-ChildItem -Path . -Filter pulsar.*.nupkg )
Write-Host "Publishing $fileName to Chocolatey"
choco push $fileName --source https://push.chocolatey.org --apikey ${{ github.secrets.CHOCO_API_KEY }}
36 changes: 36 additions & 0 deletions .github/workflows/draft_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Chocolatey Draft Publish Pulsar

on:
issues:
types: [ labeled ]

jobs:
draft_publish:
if: contains(github.event.issue.labels.*.name, 'release')
runs-on: windows-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout Latest Code
uses: actions/checkout@v3

- name: Install Python Requirements
run: pip install requests

- name: Init New Version
run: python init.py ${{ github.event.issue.title }}

- name: Create Pull Request With Changes
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Draft ${{ github.event.issue.title }} Release
branch: release-${{ github.event.issue.title }}
delete-branch: true
title: '[${{ github.event.issue.title }}] Draft Release'
body: |
Automated Draft of new Pulsar Chocolatey Release
Will close #${{ github.event.issue.number }}
draft: false
34 changes: 34 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Chocolatey Test Installation

on: [ workflow_dispatch, pull_request]

jobs:
tests:
runs-on: windows-latest

steps:
- name: Checkout the latest code
uses: actions/checkout@v3

- name: Build Current Version
run: |
cd ./pulsar
choco pack
- name: Install Current Version
run: choco install pulsar --source .

- name: Put Pulsar On the PATH
run: |
"$env:LOCALAPPDATA\Programs\Pulsar\" >> $env:GITHUB_PATH
"$env:LOCALAPPDATA\Programs\Pulsar\resources\ppm\bin\" >> $env:GITHUB_PATH
- name: Ensure Installation was successful
id: pulsar-version
run: |
(
pulsar --version |
ConvertFrom-String -PropertyNames Application,Delimiter,Version |
Where-Object {$_.Application -eq "Pulsar" } |
Select-Object -Property @{n='version'; e={ return "$($PSItem.Application) $($PSItem.Version)" }}
).version >> $env:GITHUB_STEP_SUMMARY
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,22 @@ pip install requests

## Usage

### init.py
### Automated Releases

This PR is intended to allow publishing a new Chocolatey release of Pulsar, without ever opening a terminal.
By using the simple steps laid out below:

1. Create a new issue.
* This issue should contain the exact version you want to publish as it's title. Nothing else. ex. `1.108.0`
* This issue should receive the label `release` (Best practice to add it after creating the issue)
2. A new PR will be created labeled `[<NEW_VERSION>] Draft Release`
3. Let automatic tests finish on this PR. Reviewing the workflow summary page will show what version of Pulsar these changes install. Make sure this matches what version you've intended to publish.
4. If all tests pass, merge the automatic PR.
5. With the PR now merged to `main` go ahead and trigger the GitHub Action `auto_publish`. This Action should run and if successful will publish a new version of Pulsar to Chocolatey.

### Manual Releases

#### init.py

The script will download the Pulsar installer given the input version, and edit a couple of source files accordingly, namely:

Expand All @@ -50,7 +65,7 @@ One must input the last version available on the website, otherwise the script w

Once the script terminates, the package is ready to be generated.

### Package generation
#### Package generation

Once the sources are updated, navigate to `pulsar` folder and run:

Expand Down Expand Up @@ -80,6 +95,8 @@ If everything is ok, request to publish it on Chocolatey website.
choco push pulsar.1.103.0.nupkg --source https://push.chocolatey.org/
```

---

## To do

- update package with 'latest' release; wait for a static URL to download installer; no more input parameter (version) needed
Expand Down

0 comments on commit 7882add

Please sign in to comment.