Price announcement #1177
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 to staging site" | |
on: | |
pull_request: | |
branches: | |
- master | |
concurrency: ci-${{ github.event.number }} | |
env: | |
WEBAPP_NAME: antares-blog-staging | |
RESOURCE_GROUP: appserviceblogsite | |
SLOT_NAME: pr-${{ github.event.number }} | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v1 | |
- name: Set up Ruby 3.0 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.0' | |
bundler-cache: true | |
- name: Install Ruby dependencies | |
run: | | |
gem install bundler | |
bundle install --jobs 4 --retry 3 | |
- name: Build site | |
run: bundle exec jekyll build --future --baseurl='' | |
env: | |
JEKYLL_ENV: production | |
- name: zip up site | |
run: cd _site && zip -r ../blog.zip . | |
- name: Upload artifact for deployment job | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jekyll-app | |
path: blog.zip | |
set-up-test-env: | |
name: Create test env | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Run Azure Login with OIDC | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Azure CLI script | |
uses: azure/CLI@v2 | |
with: | |
azcliversion: latest | |
inlineScript: | | |
az account show | |
- name: Create slot on staging site | |
run: | | |
az webapp deployment slot create \ | |
--resource-group $RESOURCE_GROUP \ | |
--name $WEBAPP_NAME \ | |
--slot $SLOT_NAME | |
deploy-to-slot: | |
name: Deploy to test env | |
runs-on: ubuntu-latest | |
needs: [build, set-up-test-env] | |
environment: | |
name: "production" | |
url: "${{ steps.deploy-to-webapp.outputs.webapp-url }}" | |
permissions: | |
id-token: write | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Run Azure Login with OIDC | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Azure CLI script | |
uses: azure/CLI@v2 | |
with: | |
azcliversion: latest | |
inlineScript: | | |
az account show | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v4 | |
with: | |
name: jekyll-app | |
- name: Deploy to slot on staging site | |
uses: Azure/[email protected] | |
with: | |
app-name: ${{ env.WEBAPP_NAME }} | |
slot-name: ${{ env.SLOT_NAME }} | |
package: blog.zip | |
- name: Comment on PR with the preview link | |
uses: mshick/add-pr-comment@v1 | |
with: | |
message: | | |
## Preview link: https://antares-blog-staging-pr-${{ github.event.number }}.azurewebsites.net | |
- Your changes have been deployed to the preview site. The preview site will update as you add more commits to this branch. | |
- The preview site shows any future-dated articles. If you are publishing a future-dated article, it will not show on the production site until the file's specified date. | |
- The preview link is shareable, but will be deleted when this pull request is merged or closed. | |
> *This is an automated message.* | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
repo-token-user-login: 'github-actions[bot]' | |