Add path to file type FileDrop #154
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: Build, Deploy, and Publish Formation | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20.5.0' | |
registry-url: 'https://registry.npmjs.org/' | |
- name: Set yarn version | |
run: yarn set version stable | |
- name: Install dependencies | |
run: yarn | |
- name: Build Project | |
run: yarn build | |
- name: Package Project | |
run: yarn package | |
- name: Find Package File | |
id: find-package | |
run: | | |
PKG_FILE=$(ls *.tgz) | |
echo "::set-output name=package_file::$PKG_FILE" | |
PKG_NAME=$(echo "$PKG_FILE" | sed 's/\.tgz//') | |
echo "::set-output name=package_name::$PKG_NAME" | |
- name: Deploy to Cloudflare Pages | |
uses: cloudflare/pages-action@1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: formation | |
directory: storybook-static | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.find-package.outputs.package_name }} | |
release_name: ${{ steps.find-package.outputs.package_name }} | |
draft: false | |
prerelease: false | |
- name: 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: ${{ steps.find-package.outputs.package_file }} | |
asset_name: ${{ steps.find-package.outputs.package_file }} | |
asset_content_type: application/gzip |