-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaction.yaml
124 lines (124 loc) · 5.17 KB
/
action.yaml
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: GitHub Action Release & Publish
description: GitHub Action that publishes a new release.
inputs:
checkout-repo:
required: false
description: Perform checkout as first step of action
default: "true"
build-script:
required: false
description: Custom script to run, should be defined in package.json.
default: "build"
checkout-fetch-depth:
required: false
description: The number of commits to fetch. 0 indicates all history for all branches and tags
default: "0"
github-token:
required: true
description: GitHub token that can checkout the repository as well as create tags/releases against it. e.g. 'secrets.GITHUB_TOKEN'
default: ${{ github.token }}
docker-config-file:
required: false
description: Path to the docker config file (defaults to .docker-config.json) Must contain imageName, may contain dockerfile.
default: .docker-config.json
docker-flavor:
required: false
description: Docker flavor to use for docker metadata
default: |
latest=false
dockerhub-user:
required: false
description: username for dockerhub
dockerhub-password:
required: false
description: password for dockerhub
npm-auth-token:
required: false
description: The Node Package Manager (npm) authentication token. This token is used to authenticate against a private NPM registry configured via a .npmrc file.
npm-token:
required: false
description: The Node Package Manager (npm) authentication token. This token is used to authenticate against the NPM registry.
dry-run:
required: false
description: Whether to run semantic release in `dry-run` mode. It will override the `dryRun` attribute in your configuration file
default: "false"
extra-plugins:
required: false
description: Extra plugins for pre-install. You can also specify specifying version range for the extra plugins if you prefer. Defaults to install @open-turo/semantic-release-config.
default: |
@open-turo/semantic-release-config
s3-bucket-name:
required: false
description: S3 bucket name to cache node_modules to speed up dependency installation.
s3-bucket-region:
required: false
description: S3 bucket region to cache node_modules to speed up dependency installation.
outputs:
new-release-published:
description: Whether a new release was published
value: ${{ steps.release.outputs.new-release-published }}
new-release-version:
description: Version of the new release
value: ${{ steps.release.outputs.new-release-version }}
new-release-major-version:
description: Major version of the new release
value: ${{ steps.release.outputs.new-release-major-version }}
runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v4
if: inputs.checkout-repo == 'true'
with:
fetch-depth: ${{ inputs.checkout-fetch-depth }}
persist-credentials: false
- name: Build
uses: open-turo/actions-node/build@v6
with:
build-script: ${{ inputs.build-script }}
checkout-repo: false
npm-auth-token: ${{ inputs.npm-auth-token }}
npm-token: ${{ inputs.npm-token }}
s3-bucket-name: ${{ inputs.s3-bucket-name }}
s3-bucket-region: ${{ inputs.s3-bucket-region }}
- uses: 8BitJonny/gh-get-current-pr@3.0.0
id: PR
with:
sha: ${{ github.event.pull_request.head.sha }}
- name: Branches configuration
id: branches-configuration
shell: bash
run: |
if [ -z "${{ steps.PR.outputs.number }}" ]; then
echo "branches=${{ github.event.repository.default_branch }}" >> $GITHUB_OUTPUT
else
echo "branches=[\"${{ github.event.repository.default_branch }}\", {\"name\": \"${{ github.ref_name }}\",\"channel\": \"next\",\"prerelease\": \"pr-${{ steps.PR.outputs.number }}.${{ github.run_number }}.${{ github.run_attempt }}\"}]" >> $GITHUB_OUTPUT
fi
- name: Release
id: release
uses: open-turo/actions-release/semantic-release@v5
with:
branches: ${{ steps.branches-configuration.outputs.branches }}
dry-run: ${{ inputs.dry-run }}
extra-plugins: ${{ inputs.extra-plugins }}
github-token: ${{ inputs.github-token }}
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
NPM_AUTH_TOKEN: ${{ inputs.npm-auth-token }}
NPM_TOKEN: ${{ inputs.npm-token }}
- uses: open-turo/actions-node/build-docker@v6
id: docker-build
if: inputs.dockerhub-user != '' && inputs.dockerhub-password != '' && steps.release.outputs.new-release-version != ''
with:
docker-config-file: ${{ inputs.docker-config-file }}
dockerhub-user: ${{ inputs.dockerhub-user }}
dockerhub-password: ${{ inputs.dockerhub-password }}
github-token: ${{ inputs.github-token }}
npm-auth-token: ${{ inputs.npm-auth-token }}
npm-token: ${{ inputs.npm-token }}
image-version: ${{ steps.release.outputs.new-release-version }}
docker-flavor: ${{ inputs.docker-flavor }}
docker-metadata-tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}},value=${{ steps.release.outputs.new-release-version }}