-
Notifications
You must be signed in to change notification settings - Fork 3
68 lines (68 loc) · 2.81 KB
/
deploy-feature.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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