diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml new file mode 100644 index 0000000..427a886 --- /dev/null +++ b/.github/workflows/deploy-staging.yml @@ -0,0 +1,79 @@ +name: Stage the app + +on: + pull_request: + types: [labeled] + +env: + DOCKER_IMAGE_NAME: larsbj-azure-ttt + IMAGE_REGISTRY_URL: docker.pkg.github.com + ################################################# + ### USER PROVIDED VALUES ARE REQUIRED BELOW ### + ################################################# + ################################################# + ### REPLACE USERNAME WITH GH USERNAME ### + AZURE_WEBAPP_NAME: larsbj-ttt-app + ################################################# + +jobs: + build: + if: contains(github.event.pull_request.labels.*.name, 'stage') + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: npm install and build webpack + run: | + npm install + npm run build + - uses: actions/upload-artifact@master + with: + name: webpack artifacts + path: public/ + + Build-Docker-Image: + runs-on: ubuntu-latest + needs: build + name: Build image and store in GitHub Packages + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Download built artifact + uses: actions/download-artifact@master + with: + name: webpack artifacts + path: public + + - name: create image and store in Packages + uses: mattdavis0351/actions/docker-gpr@1.3.0 + with: + repo-token: ${{secrets.GITHUB_TOKEN}} + image-name: ${{env.DOCKER_IMAGE_NAME}} + + Deploy-to-Azure: + runs-on: ubuntu-latest + needs: Build-Docker-Image + name: Deploy app container to Azure + steps: + - name: "Login via Azure CLI" + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/docker-login@v1 + with: + login-server: ${{env.IMAGE_REGISTRY_URL}} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Deploy web app container + uses: azure/webapps-deploy@v2 + with: + app-name: ${{env.AZURE_WEBAPP_NAME}} + images: ${{env.IMAGE_REGISTRY_URL}}/${{ github.repository }}/${{env.DOCKER_IMAGE_NAME}}:${{ github.sha }} + + - name: Azure logout + run: | + az logout diff --git a/package-lock.json b/package-lock.json index f6db4a9..a53cb2f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6077,10 +6077,9 @@ } }, "node-forge": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz", - "integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==", - "dev": true + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", + "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" }, "node-int64": { "version": "0.4.0", @@ -7535,6 +7534,14 @@ "dev": true, "requires": { "node-forge": "0.9.0" + }, + "dependencies": { + "node-forge": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz", + "integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==", + "dev": true + } } }, "semver": { diff --git a/package.json b/package.json index 1fc1417..1abe7ba 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "webpack-dev-server": "^3.11.0" }, "dependencies": { - "kind-of": "^6.0.3" + "kind-of": "^6.0.3", + "node-forge": "^0.10.0" } }