forked from nhost/nhost
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (78 loc) · 2.35 KB
/
wf_release_npm.yaml
File metadata and controls
91 lines (78 loc) · 2.35 KB
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
91
---
on:
workflow_call:
inputs:
NAME:
type: string
required: true
PATH:
type: string
required: true
VERSION:
type: string
required: true
secrets:
AWS_ACCOUNT_ID:
required: true
NIX_CACHE_PUB_KEY:
required: true
NIX_CACHE_PRIV_KEY:
required: true
DISCORD_WEBHOOK:
required: false
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
working-directory: ${{ inputs.PATH }}
permissions:
id-token: write
contents: read
steps:
- name: "Check out repository"
uses: actions/checkout@v6
- name: Configure aws
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions-nhost-${{ github.event.repository.name }}
aws-region: eu-central-1
- name: Setup Nix with Cache
uses: ./.github/actions/setup-nix
with:
NAME: ${{ inputs.NAME }}
NIX_CACHE_PUB_KEY: ${{ secrets.NIX_CACHE_PUB_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Build package"
run: make build
- name: "Copy build output"
run: cp -r result/dist .
- name: "Set package version"
run: |
nix develop .#pnpm -c pnpm version ${{ inputs.VERSION }} --no-git-tag-version
- name: "Determine npm tag"
id: npm-tag
run: |
if [[ "${{ inputs.VERSION }}" =~ (alpha|beta|dev|rc) ]]; then
echo "tag=beta" >> $GITHUB_OUTPUT
else
echo "tag=latest" >> $GITHUB_OUTPUT
fi
- name: "Publish to npm"
run: |
nix develop .#pnpm -c pnpm publish --tag ${{ steps.npm-tag.outputs.tag }} --no-git-checks
- name: Send Discord notification
if: always()
uses: ./.github/actions/discord-notification
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
title: "Published ${{ inputs.NAME }}@${{ inputs.VERSION }} to npm"
description: |
**Status**: ${{ job.status }}
**Tag**: ${{ steps.npm-tag.outputs.tag }}
**Triggered by**: ${{ github.actor }}
**Details**:
- Version: ${{ inputs.VERSION }}
- Package: ${{ inputs.NAME }}
color: ${{ job.status == 'success' && '5763719' || '15548997' }}