forked from americanexpress/one-app
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (62 loc) · 2.4 KB
/
release-step-6-automatic_publish-one-app-statics-to-npm.yml
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
name: '[Release step 6 | automatic] Publish One App Statics to NPM'
on:
workflow_dispatch:
inputs:
tag_version:
description: 'Semantic Version'
required: true
repository_dispatch:
types: [release-step-6-automatic_publish-one-app-statics-to-npm]
jobs:
release-step-6-automatic_publish-one-app-statics-to-npm:
name: One App Statics Publish to NPM
runs-on: ubuntu-latest
steps:
- name: Tag Version
id: set_tag_version
run: |
if [[ "${{ github.event.inputs.tag_version }}" == "" ]]
then
echo "tagversion=${{ github.event.client_payload.docker_tag_version }}" >> $GITHUB_OUTPUT
else
echo "tagversion=${{ github.event.inputs.tag_version }}" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
with:
ref: "v${{ steps.set_tag_version.outputs.tagversion}}"
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: 'https://registry.npmjs.org'
- name: Docker login
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login --username ${{ secrets.DOCKER_USER }} --password-stdin
- name: Extract and zip production statics
run: |
docker create --name prod ${{ secrets.DOCKER_USER }}/one-app:${{ steps.set_tag_version.outputs.tagversion}}
docker cp prod:opt/one-app/build ./one-app-statics
zip -r one-app-static-assets one-app-statics/build
- name: Publish statics to NPM
run: npm publish ./one-app-statics --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.set_tag_version.outputs.tagversion }}
release_name: Release v${{ steps.release_tag.outputs.releasetag }}
draft: true
prerelease: false
- name: Upload Release Assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./one-app-static-assets.zip
asset_name: one-app-static-assets.zip
asset_content_type: application/zip