diff --git a/.github/composite-actions/install/action.yml b/.github/composite-actions/install/action.yml new file mode 100644 index 0000000..b6af10a --- /dev/null +++ b/.github/composite-actions/install/action.yml @@ -0,0 +1,73 @@ +name: 'Install' +description: 'Sets up Node.js and runs install' + +inputs: + npm-token: + description: 'A read-only npm token' + required: true + vercel-private-registry-token: + description: 'A token used to access the Vercel Private Registry' + required: true + node-version-file: + description: 'A custom node version' + required: false + default: '.nvmrc' + node-version: + description: 'The version of node, should be 16 or 20' + default: '20' + required: false + filter: + description: 'A list of pnpm filters - see https://pnpm.io/filtering' + required: false + default: '' + + +runs: + using: composite + steps: + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: ${{ inputs.node-version-file }} + registry-url: 'https://registry.npmjs.org' + + - name: "Install corepack v0.20" + if: ${{ inputs.node-version == '16' }} + shell: bash + run: | + echo "corepack version before: $(corepack --version)" + # 0.20 is the highest we can go, 0.20 drops node 16 support + # https://github.com/nodejs/corepack/blob/main/CHANGELOG.md#0210-2023-10-08 + npm install -g corepack@0.20 + echo "corepack version after: $(corepack --version)" + + - name: "Install corepack@0.31" + if: ${{ inputs.node-version != '16' }} + shell: bash + run: | + npm install -g corepack@0.31 + echo "corepack version after: $(corepack --version)" + + - name: corepack enable (pnpm) + shell: bash + run: corepack enable + - name: Print pnpm version + shell: bash + run: | + echo "pnpm version after corepack enable: $(pnpm --version)" + + - name: Parse filter + id: parse-filter + shell: bash + run: | + echo "pnpm-filter-args=$(echo '"${{ inputs.filter }}"' | jq -r 'split(" ") | map(select(. != "")) | map("--filter " + .) | join(" ")')" >> "$GITHUB_OUTPUT" + + - name: Install dependencies + shell: bash + run: | + pnpm config set //vercel-private-registry.vercel.sh/:_authToken ${{ inputs.vercel-private-registry-token }} + # filter is a JSON string, so we need to parse it and pass it as separate arguments + pnpm ${{ steps.parse-filter.outputs.pnpm-filter-args }} install --frozen-lockfile + env: + NODE_AUTH_TOKEN: ${{ inputs.npm-token }} + VERCEL_PRIVATE_REGISTRY_TOKEN: ${{ inputs.vercel-private-registry-token }} diff --git a/.github/workflows/azure-webapps-node.yml b/.github/workflows/azure-webapps-node.yml new file mode 100644 index 0000000..2ebbac2 --- /dev/null +++ b/.github/workflows/azure-webapps-node.yml @@ -0,0 +1,78 @@ +# This workflow will build and push a node.js application to an Azure Web App when a commit is pushed to your default branch. +# +# This workflow assumes you have already created the target Azure App Service web app. +# For instructions see https://docs.microsoft.com/en-us/azure/app-service/quickstart-nodejs?tabs=linux&pivots=development-environment-cli +# +# To configure this workflow: +# +# 1. Download the Publish Profile for your Azure Web App. You can download this file from the Overview page of your Web App in the Azure Portal. +# For more information: https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials +# +# 2. Create a secret in your repository named AZURE_WEBAPP_PUBLISH_PROFILE, paste the publish profile contents as the value of the secret. +# For instructions on obtaining the publish profile see: https://docs.microsoft.com/azure/app-service/deploy-github-actions#configure-the-github-secret +# +# 3. Change the value for the AZURE_WEBAPP_NAME. Optionally, change the AZURE_WEBAPP_PACKAGE_PATH and NODE_VERSION environment variables below. +# +# For more information on GitHub Actions for Azure: https://github.com/Azure/Actions +# For more information on the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples + +on: + push: + branches: [ "main" ] + workflow_dispatch: + +env: + AZURE_WEBAPP_NAME: your-app-name # set this to your application's name + AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root + NODE_VERSION: '20.x' # set this to the node version to use + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: npm install, build, and test + run: | + npm install + npm run build --if-present + npm run test --if-present + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v4 + with: + name: node-app + path: . + + deploy: + permissions: + contents: none + runs-on: ubuntu-latest + needs: build + environment: + name: 'Development' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v4 + with: + name: node-app + + - name: 'Deploy to Azure WebApp' + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: ${{ env.AZURE_WEBAPP_NAME }} + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} + package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} diff --git a/README.md b/README.md index 70e15a0..7df16a6 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ -Shared community files for [the Vercel organization](https://vercel.com/). +https://smee.io/GfMQJ9vR23BJq1 + diff --git a/SECURITY.md b/SECURITY.md index efb3959..3268652 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,4 +4,4 @@ If you believe you have found a security vulnerability, we encourage you to let We will investigate all legitimate reports and do our best to quickly fix the problem. -Please report any vulnerabilities in our open source repositories to responsible.disclosure@vercel.com. +Please report any vulnerabilities in our open source email to minhtuktran@gmail.com. diff --git a/profile/README.md b/profile/README.md new file mode 100644 index 0000000..d538f94 --- /dev/null +++ b/profile/README.md @@ -0,0 +1,16 @@ +## Hi there šŸ‘‹ + +