Skip to content

Commit

Permalink
test release gh action
Browse files Browse the repository at this point in the history
Signed-off-by: marcopiraccini <[email protected]>
  • Loading branch information
marcopiraccini committed Dec 13, 2023
1 parent 7eb74b2 commit a38fa1c
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 30 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/release-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: release-draft
on:
workflow_dispatch:
workflow_call:
inputs:
tag_name:
type: string
push:
branches:
- main
Expand All @@ -19,7 +22,11 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- run: echo "Creating Linux draft release for tag ${{ inputs.tag_name }}"
- uses: actions/[email protected]
with:
ref: ${{ inputs.tag_name }}
fetch-depth: 0 # https://github.com/actions/checkout/issues/1471
- uses: actions/setup-node@v4
with:
node-version: 18
Expand All @@ -38,6 +45,7 @@ jobs:
SM_CLIENT_CERT_FILE: D:\\Certificate_pkcs12.p12
SM_CLIENT_CERT_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
steps:
- run: echo "Creating Windows release for tag ${{ inputs.tag_name }}"
- name: Set up certificate
run: |
echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
Expand Down Expand Up @@ -77,7 +85,10 @@ jobs:
with:
node-version: 18

- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/[email protected]
with:
ref: ${{ inputs.tag_name }}
fetch-depth: 0 # https://github.com/actions/checkout/issues/1471
- run: npm ci
- run: npm run build:win
- run: npm run release:win
Expand All @@ -92,7 +103,11 @@ jobs:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- run: echo "Creating Mac release for tag ${{ inputs.tag_name }}"
- uses: actions/[email protected]
with:
ref: ${{ inputs.tag_name }}
fetch-depth: 0 # https://github.com/actions/checkout/issues/1471
- uses: actions/setup-node@v4
with:
node-version: 18
Expand Down
67 changes: 60 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,78 @@ name: release

on:
workflow_dispatch:
inputs:
versionType:
type: choice
description: 'The type of release to create'
required: true
options:
- 'patch'
- 'minor'
- 'major'

jobs:
# create-draft:
# uses: platformatic/meraki/.github/workflows/release-draft.yml@main
run-test:
name: Run Tests
uses: platformatic/meraki/.github/workflows/test.yml@main

prepare-release:
name: Prepare release tag
needs: run-test
runs-on: ubuntu-latest
outputs:
TAG: v${{ steps.tag-name.outputs.TAG }}
steps:
- name: Checkout
uses: actions/checkout@v4
- id: version-bump
name: 'Automated Version Bump'
uses: 'phips28/gh-action-bump-version@master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version-type: ${{ github.event.inputs.versionType }}
tag-prefix: 'v'
- name: Export TAG Parameter
id: tag-name
run: |
echo "TAG=`cat package.json | jq -r .version`" >> $GITHUB_OUTPUT
shell: bash

create-draft:
needs: prepare-release
# TODO: restore `main` for the branch
name: Create Draft Release
uses: platformatic/meraki/.github/workflows/release-draft.yml@release-gh
with:
tag_name: ${{ needs.prepare-release.outputs.TAG }}
secrets: inherit

release:
name: Release
needs: create-draft
runs-on: ubuntu-latest
steps:
steps:
- name: Get last Draft
id: last_release
uses: InsonusK/[email protected] # https://github.com/InsonusK/get-latest-release
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
exclude_types: "release"
exclude_types: "release|prerelease"
view_top: 1
- name: "Print result"

- name: "Print draft info"
run: |
echo "Releasing:"
echo "id: ${{ steps.last_release.outputs.id }}"
echo "name: ${{ steps.last_release.outputs.name }}"
echo "tag_name: ${{ steps.last_release.outputs.tag_name }}"
echo "created_at: ${{ steps.last_release.outputs.created_atd }}"
echo "draft: ${{ steps.last_release.outputs.draft }}"
echo "prerelease: ${{ steps.last_release.outputs.prerelease }}"
- name: "Publish Release"
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.last_release.outputs.id }}

17 changes: 0 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,3 @@ $ npm run build:mac
$ npm run build:linux
```

### Prepare a release tag

Releases are created from tags, so you need to create a tag before you can create a release, e.g. if the current development version is `0.1.0`:

```bash
git pull # Make sure you have the latest changes
git tag -a v0.1.0 -m "Release 0.1.0"
git push origin v0.1.0
```

Then you have to do a version bump:
```bash
npm version --no-git-tag-version minor # or major, patch, etc.
git add package.json
git commit -m "version bump"
git push
```
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "meraki",
"private": true,
"version": "0.2.0",
"version": "0.2.8",
"main": "./out/main/index.js",
"author": "Platformatic.dev",
"license": "Apache-2.0",
Expand Down

0 comments on commit a38fa1c

Please sign in to comment.