diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18b6b57..8b13789 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,46 +1 @@ -# Continuous Integration workflow to: -# 1. Build, lint, and test project -# 2. Commit any updates to "dist" folder -on: - push: - branches: - - main - pull_request: - -name: Continuous Integration - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-node@v2 - with: - node-version: '12' - - - run: npm install - - - run: npm run build - - - run: npm run lint - - - run: npm run test - - - name: Examine changes - run: |- - echo 'FILES_CHANGED<> $GITHUB_ENV - git diff --exit-code dist/index.js >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV - - - name: Update dist - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && env.FILES_CHANGED }} - uses: swinton/commit@v2.x - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - files: - dist/index.js - commit-message: Update dist \ No newline at end of file diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..2057df1 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,61 @@ +name: tester1 +on: + workflow_dispatch: +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: '12' + + - run: npm install + + - run: npm run build + + - run: npm run lint + + - run: npm run test + + - name: Examine changes + run: |- + echo 'FILES_CHANGED<> $GITHUB_ENV + git diff --exit-code dist/index.js >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + + - name: Update dist + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && env.FILES_CHANGED }} + uses: swinton/commit@v2.x + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + files: + dist/index.js + commit-message: Update dist + Deploy: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: Upload to blob storage + uses: Azure/cli@1.0.4 + with: + inlineScript: | + az storage blob upload-batch --account-name staticcontent1 --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key --overwrite -d '$web' -s dist/ + + - name: Purge CDN endpoint + uses: azure/CLI@v1 + with: + inlineScript: | + az cdn endpoint purge --content-paths "/*" --profile-name "staticwebsite" --name "staticwebsite123" --resource-group "tester" + - name: logout + run: | + az logout + if: always() diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3289158..8b13789 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,21 +1 @@ -# Publish workflow to automate semantic tagging after manual release -# Read more here: https://docs.github.com/en/actions/creating-actions/about-actions#using-release-management-for-actions -name: Publish - -on: - release: - types: [published, edited] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: ${{ github.event.release.tag_name }} - - - uses: JasonEtco/build-and-tag-action@v2 - env: - GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 0000000..a60ffe5 --- /dev/null +++ b/dist/index.html @@ -0,0 +1,6 @@ +Hello World +Hello World +Hello World +Hello World +Hello World +Hello World diff --git a/index.html b/index.html new file mode 100644 index 0000000..b3eee0a --- /dev/null +++ b/index.html @@ -0,0 +1,4 @@ +Hello World +Hello World +Hello World +Hello World