Merge pull request #444 from internxt/feat/access-logs #2102
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-number: | ||
type: number | ||
jobs: | ||
retrive-pr: | ||
runs-on: ubuntu-latest | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
PR=$(gh pr view ${{ github.event.inputs.pr-number }} --json headRefName,state,headRepository,number,title) | ||
echo 'PR_BRANCH=$(jq -r '.headRefName' <<< "$PR")' >> $GITHUB_ENV | ||
build: | ||
needs: retrive-pr | ||
runs-on: ubuntu-latest | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: $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-wip | ||
run: echo "Would build the image with tag drive-server-wip:${{ github.sha }}-pr${{ github.event.inputs.pr-number }}" | ||
# uses: docker/build-push-action@v2 | ||
# with: | ||
# context: ./ | ||
# file: ./development.Dockerfile | ||
# push: true | ||
# tags: ${{ secrets.DOCKERHUB_USERNAME }}/drive-server-wip-dev:${{ github.sha }}-pr${{ github.event.inputs.pr-number }} | ||
deploy: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: develop | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Update drive-server-wip image | ||
run: echo "Would set the image drive-server-wip-dev:${{ github.sha }}-pr${{ github.event.inputs.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-wip-dev drive-server-wip-dev=${{ secrets.DOCKERHUB_USERNAME }}/drive-server-wip-dev:${{ github.sha }}-pr${{ github.event.inputs.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-wip-dev |