[PB-1428]: feat/limit-upload-file-size #216
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: Deploy feature | |
on: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
pr: | |
type: string | |
jobs: | |
retrive-pr: | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
outputs: | |
PR_BRANCH: ${{ steps.view-pr.outputs.PR_BRANCH }} | |
PR_NUMBER: ${{ steps.view-pr.outputs.PR_NUMBER }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: View pr | |
id: view-pr | |
run: | | |
PR=$(gh pr view ${{ github.event.inputs.pr }} --json headRefName,state,headRepository,number,title) | |
if [ $(jq -r '.headRepository.name' <<< "$PR") != ${{ github.event.repository.name }} ]; | |
then | |
echo "Invalid PR" | |
exit 1 | |
fi | |
echo "PR_BRANCH=$(jq -r '.headRefName' <<< "$PR")" >> $GITHUB_OUTPUT | |
echo "PR_NUMBER=$(jq -r '.number' <<< "$PR")" >> $GITHUB_OUTPUT | |
- name: Print the output variable in another step | |
run: | | |
echo "Branch name: ${{ steps.view-pr.outputs.PR_BRANCH }}" | |
echo "PR number: ${{ steps.view-pr.outputs.PR_NUMBER }}" | |
build: | |
needs: retrive-pr | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ needs.retrive-pr.outputs.PR_BRANCH }} | |
registry-url: 'https://npm.pkg.github.com' | |
- name: Create .npmrc file | |
run: | | |
echo "registry=https://registry.yarnpkg.com/" > .npmrc | |
echo "@internxt:registry=https://npm.pkg.github.com" >> .npmrc | |
# You cannot read packages from other private repos with GITHUB_TOKEN | |
# You have to use a PAT instead https://github.com/actions/setup-node/issues/49 | |
echo //npm.pkg.github.com/:_authToken=${{ secrets.PERSONAL_ACCESS_TOKEN }} >> .npmrc | |
echo "always-auth=true" >> .npmrc | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and push to drive-server | |
run: echo "Would build the image with tag drive-server:${{ github.sha }}-pr${{ needs.retrive-pr.outputs.PR_NUMBER }}" | |
# uses: docker/build-push-action@v2 | |
# with: | |
# context: ./ | |
# file: ./development.Dockerfile | |
# push: true | |
# tags: ${{ secrets.DOCKERHUB_USERNAME }}/drive-server-dev:${{ github.sha }}-pr${{ needs.retrive-pr.outputs.PR_NUMBER }} | |
deploy: | |
needs: [build,retrive-pr] | |
runs-on: ubuntu-latest | |
environment: | |
name: develop | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Update drive-server image | |
run: echo "Would set the image drive-server-dev:${{ github.sha }}-pr${{ needs.retrive-pr.outputs.PR_NUMBER }}" | |
# uses: steebchen/[email protected] | |
# with: # defaults to latest kubectl binary version | |
# config: ${{ secrets.KUBE_CONFIG_DATA_DEVELOPMENT }} | |
# version: v1.22.2 | |
# command: set image --record deployment/drive-server-dev drive-server-dev=${{ secrets.DOCKERHUB_USERNAME }}/drive-server-dev:${{ github.sha }}-pr${{ needs.retrive-pr.outputs.PR_NUMBER }} | |
# - name: Verify drive-server deployment | |
# uses: steebchen/[email protected] | |
# with: | |
# config: ${{ secrets.KUBE_CONFIG_DATA_DEVELOPMENT }} | |
# version: v1.22.2 # specify kubectl binary version explicitly | |
# command: rollout status deployment/drive-server-dev |