Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme: remove docker, add chocolatey. Update framework targets #315

Merged
merged 16 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions .github/workflows/build-APIdocs-layer.yml

This file was deleted.

134 changes: 108 additions & 26 deletions .github/workflows/build-and-stage.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,125 @@
name: build-website
on:
workflow_run:
workflows: [build-api-docs]
types: [completed]
pull_request:
branches:
- main
paths:
- "*"
- "!README.md"
- "!docfx/"
- "!build-metadata.sh"
- "!metadata.conf"
push:
branches:
- main
paths:
- "*"
- "!README.md"
- "!docfx/"
- "!build-metadata.sh"
- "!Dockerfile-metadata"
- "!metadata.conf"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: 'read'
pull-requests: 'write'

env:
IMAGE_TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.run_id }}
DOCFX_VERSION: 2.59.4
STEELTOE_V2_VERSION: 2.5.5
STEELTOE_V3_VERSION: 3.2.6
SITE_IMAGE_VERSION: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.run_id }}

jobs:
change-detection:
name: Detect which layers need to be built, set image versions
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
docfx-layer-changed: ${{ steps.filter.outputs.docfx-layer-changed }}
docfx-image-version: ${{ steps.version.outputs.docfx-image-version }}
metadata-layer-changed: ${{ steps.filter.outputs.metadata-layer-changed }}
metadata-image-version: ${{ steps.version.outputs.metadata-image-version }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docfx-layer-changed:
- .github/workflows/build-and-stage.yml
- 'docfx/**'
metadata-layer-changed:
- .github/workflows/build-and-stage.yml
- Dockerfile-metadata
- /api-*.json
bart-vmware marked this conversation as resolved.
Show resolved Hide resolved
- build-metadata.sh
bart-vmware marked this conversation as resolved.
Show resolved Hide resolved
- name: Declare image versions
id: version
run: |
if '${{ steps.filter.outputs.docfx-layer-changed }}' = 'true'
bart-vmware marked this conversation as resolved.
Show resolved Hide resolved
then
echo "docfx-image-version=${{ github.event_name == 'pull_request' && format('{0}-pr{1}', env.DOCFX_VERSION, github.event.number) || env.DOCFX_VERSION }}" >> "$GITHUB_OUTPUT"
else
echo "docfx-image-version=${{ env.DOCFX_VERSION }}" >> "$GITHUB_OUTPUT"
fi
if '${{ steps.filter.outputs.metadata-layer-changed }}' = 'true'
then
echo "metadata-image-version=${{ github.event_name == 'pull_request' && format('{0}-pr{1}', env.STEELTOE_VERSIONS, github.event.number) || env.STEELTOE_VERSIONS }}" >> "$GITHUB_OUTPUT"
else
echo "metadata-image-version=${{ env.STEELTOE_VERSIONS }}" >> "$GITHUB_OUTPUT"
fi
env:
STEELTOE_VERSIONS: ${{ env.STEELTOE_V2_VERSION }}-${{ env.STEELTOE_V3_VERSION }}
shell: bash

build-push-docfx:
name: Build and push docfx layer
needs: change-detection
if: ${{ needs.change-detection.outputs.docfx-layer-changed }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set DocFX version to use
run: echo v${{ env.DOCFX_VERSION }} > docfx/version
shell: bash

- name: Login to container registry
uses: docker/login-action@v3
with:
registry: "${{ vars.DOCKER_REGISTRY }}"
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"

- name: Build image
run: docker build docfx --file "docfx/Dockerfile" -t ${{ vars.DOCKER_REGISTRY }}/docfx:${{ needs.change-detection.outputs.docfx-image-version }}

- name: Push image
run: docker push ${{ vars.DOCKER_REGISTRY }}/docfx --all-tags

build-push-metadata:
name: Build and push API docs layer
needs: [ change-detection, build-push-docfx ]
if: ${{ needs.change-detection.outputs.metadata-layer-changed }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set Steeltoe versions to use
run: |-
echo '2:'${{ env.STEELTOE_V2_VERSION }} > metadata.conf
echo '3:'${{ env.STEELTOE_V3_VERSION }} >> metadata.conf
bart-vmware marked this conversation as resolved.
Show resolved Hide resolved
shell: bash

- name: Login to container registry
uses: docker/login-action@v3
with:
registry: "${{ vars.DOCKER_REGISTRY }}"
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"

- name: Build image
run: docker build --build-arg="DOCFX_IMAGE_VERSION=${{ needs.change-detection.outputs.docfx-image-version }}" . --file "Dockerfile-metadata" -t ${{ vars.DOCKER_REGISTRY }}/documentation-metadata:${{ needs.change-detection.outputs.metadata-image-version }}
bart-vmware marked this conversation as resolved.
Show resolved Hide resolved

- name: Push image
run: docker push ${{ vars.DOCKER_REGISTRY }}/documentation-metadata --all-tags
bart-vmware marked this conversation as resolved.
Show resolved Hide resolved

build-push-deploy:
name: Build and push documentation image
needs: [ change-detection, build-push-docfx, build-push-metadata ]
environment:
name: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || vars.STAGING_SLOT_NAME }}
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
Expand All @@ -59,10 +142,10 @@ jobs:
password: "${{ secrets.DOCKER_PASSWORD }}"

- name: Build image
run: docker build . --file "Dockerfile" -t ${{ vars.DOCKER_REGISTRY }}/documentation:${{ env.IMAGE_TAG }}
run: docker build --build-arg="METADATA_IMAGE_VERSION=${{ needs.change-detection.outputs.metadata-image-version }}" . --file "Dockerfile" -t ${{ vars.DOCKER_REGISTRY }}/documentation:${{ env.SITE_IMAGE_VERSION }}

- name: Push image
run: docker push ${{ vars.DOCKER_REGISTRY }}/documentation:${{ env.IMAGE_TAG }}
run: docker push ${{ vars.DOCKER_REGISTRY }}/documentation --all-tags

- name: If PR, create a new staging slot
if: ${{ github.event_name == 'pull_request' }}
Expand All @@ -74,21 +157,20 @@ jobs:
- name: Deploy to staging slot
uses: azure/webapps-deploy@v3
id: deploy-to-webapp
with:
with:
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
images: ${{ vars.DOCKER_REGISTRY }}/documentation:${{ env.IMAGE_TAG }}
images: ${{ vars.DOCKER_REGISTRY }}/documentation:${{ env.SITE_IMAGE_VERSION }}
slot-name: ${{ env.SLOT_NAME }}

- name: If PR, comment with the preview link
if: ${{ github.event_name == 'pull_request' }}
uses: mshick/add-pr-comment@v2
with:
message: |
## Preview link: https://${{ vars.AZURE_WEBAPP_NAME }}-${{ env.SLOT_NAME }}.azurewebsites.net
## Preview link: https://${{ vars.AZURE_WEBAPP_NAME }}-${{ env.SLOT_NAME }}.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 link is shareable, but will be deleted when the pull request is merged or closed.

> *This is an automated message.*
repo-token: ${{ secrets.GITHUB_TOKEN }}

43 changes: 0 additions & 43 deletions .github/workflows/build-base-layer.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/pr-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Delete slot on staging site
run: az webapp deployment slot delete --resource-group ${{ vars.AZURE_RESOURCE_GROUP }} --name ${{ vars.AZURE_WEBAPP_NAME}} --slot ${{ env.SLOT_NAME }}

Expand All @@ -29,4 +29,3 @@ jobs:
with:
environment: "pr-${{ github.event.number }}"
token: ${{ secrets.GITHUB_TOKEN }}
onlyRemoveDeployments: true
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM steeltoe.azurecr.io/documentation-metadata:2.5.5-3.2.6 AS build
ARG METADATA_IMAGE_VERSION=2.5.5-3.2.6
FROM steeltoe.azurecr.io/documentation-metadata:${METADATA_IMAGE_VERSION} AS build
bart-vmware marked this conversation as resolved.
Show resolved Hide resolved
WORKDIR /docs
COPY . .
RUN docfx build -o /built-docs --globalMetadataFiles main-site.json
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile-metadata
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM steeltoe.azurecr.io/docfx:2.59.2
ARG DOCFX_IMAGE_VERSION=2.59.4
FROM steeltoe.azurecr.io/docfx:${DOCFX_IMAGE_VERSION}
WORKDIR /docs
COPY . .
RUN ["chmod", "+x", "./build-metadata.sh"]
Expand Down
Loading
Loading