This repository has been archived by the owner on May 3, 2024. It is now read-only.
release-step-6-automatic_publish-one-app-statics-to-npm #113
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |