Skip to content

Commit e6b2a57

Browse files
committed
Update README and example for marketplace release
1 parent e87c050 commit e6b2a57

File tree

5 files changed

+50
-81
lines changed

5 files changed

+50
-81
lines changed

README.md

+50-81
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22

33
[GitHub Actions](https://help.github.com/en/articles/about-github-actions) provides the flexibility to build automated workflows for the software development lifecycle.
44

5-
GitHub Actions can be used to automate the workflow of creating a new revision of [Azure Container App](https://azure.microsoft.com/en-us/services/container-apps/).
6-
The aca-review-app runs the code contained in the GitHub pull request as an app in the Container App. The review app is then created as a new revision with a Weight of 0, each with a unique URL that can be shared. This is a great way to review and test code changes.
5+
**aca-review-app** can be used to automate the workflow of creating a new revision of [Azure Container App](https://azure.microsoft.com/en-us/services/container-apps/) for review.
6+
This action runs the code contained in the GitHub pull request as an app in the Container App. The review application is then created as a new revision with a Weight of 0, each with a unique URL that can be shared. This is a great way to review and test code changes. This action allows deactivating an app for review that has been created, triggered by the close of a pull request.
77

8-
Review apps can also be configured to launch automatically with each pull request. Also, when combined with `peter-evans/create-or-update-comment@v2` or similar, you can not only create a revision, but also comment the URL of the created Revision in the Pull Request.
8+
**aca-review-app** can also be configured to launch automatically with each pull request. By integrating with other github actions, it is also possible not only to create revisions, but also to comment the URL of the created revision in a pull request. For more information, please refer to the [eample workflow](./example/).
99

1010
Let's get started today with a [free Azure account](https://azure.com/free/open-source)!
1111

1212
The definition of this GitHub Action is in [action.yml](./action.yml).
1313

1414
## End-to-End Sample Workflows
1515

16+
The **[```example/```](./example/)** in this repository contains a sample project to get started. Please read the hands-on documentation and start building.
17+
1618
### Dependencies on other GitHub Actions
1719

1820
* [Azure Login](https://github.com/Azure/login) Login with your Azure Credentials for Authentication. Once login is done, the next set of Azure Actions in the workflow can re-use the same session within the job.
@@ -55,98 +57,65 @@ For using any credentials like Azure Service Principal in your workflow, add the
5557

5658
1. Now in the workflow file in your branch: `.github/workflows/workflow.yml` replace the secret in Azure login action with your secret (Refer to the example below)
5759

58-
### Build and Deploy a Node.JS App to Azure Container App
60+
### Integration to leave comments on Pull Request
5961

60-
```yaml
62+
#### Sample Snipet for the Review Revision Creation
6163

62-
on: [push]
63-
name: Linux_Container_Workflow
64+
You can pass the app URL for review to subsequent actions as follows.
6465

65-
SAMPLE WORKFLOW WILL BE HERE
66+
```yaml
67+
- name: Add revision to ACA
68+
uses: Azure/[email protected]
69+
id: aca_new_revision
70+
with:
71+
resource-group: <YOUR_RESOURCE_GROUP>
72+
name: <YOUR_CONTAINER_APP_NAME>
73+
revision-name-suffix: <SHORT_HASH>
74+
image: <YOUR_CONTAINER_IMAGE>
6675

76+
- name: add new comment to PR
77+
uses: peter-evans/create-or-update-comment@v2
78+
with:
79+
issue-number: ${{ github.event.pull_request.number }}
80+
body: |
81+
Revision ${{ env.CONTAINERAPP_NAME }}--${{ env.SHORT_HASH }} is created.
82+
${{ steps.aca_new_revision.outputs.app-url }}
6783
```
6884
69-
### Example YAML Snippets
85+
#### Sample Snipet for the Review Revision Deactivation
7086
71-
#### Basic sample to create a revision
87+
This action can also automatically deactivate revisions.
88+
However, this flow must be triggered only when the pull request is closed. For more information, see the [sample](./example/) implementation.
7289
7390
```yaml
74-
on: [push, pull_request]
75-
name: Preview Deployment
76-
jobs:
77-
build-and-deploy:
78-
runs-on: ubuntu-latest
79-
env:
80-
RESOURCE_GROUP: <YOUR_RESOURCE_GROUP_NAME>
81-
CONTAINER_APP_NAME: <YOUR_CONTAINER_APP_NAME>
82-
DOCKER_IMAGE_NAME: <YOUR_DOCKER_IMAGE_NAME>
83-
# REVISION_NAME_SUFFIX: <YOUR_REVISION_NAME_SUFFIX> # Optional: Default is github commit hash
84-
steps:
85-
- name: 'Checkout GitHub Action'
86-
uses: actions/checkout@master
87-
- name: 'Login via Azure CLI'
88-
uses: azure/login@v1
89-
with:
90-
creds: ${{ secrets.AZURE_CREDENTIALS }}
91-
- name: 'Create a new Container App revision'
92-
uses: azure/[email protected]
93-
with:
94-
resource-group: ${{ env.RESOURCE_GROUP }}
95-
name: ${{ env.CONTAINER_APP_NAME }}
96-
image: ${{ env.DOCKER_IMAGE_NAME }}
97-
```
98-
99-
##### Using customize suffice instead of git commit hash
100-
101-
```yaml
102-
- name: 'Create a new Container App revision'
103-
uses: azure/[email protected]
91+
- name: Deactivate Preview revision on ACA
92+
uses: Azure/[email protected]
10493
with:
105-
resource-group: ${{ env.RESOURCE_GROUP }}
106-
name: ${{ env.CONTAINER_APP_NAME }}
107-
image: ${{ env.DOCKER_IMAGE_NAME }}
108-
revision-name-suffix: ${{ env.REVISION_NAME_SUFFIX }}
94+
resource-group: <YOUR_RESOURCE_GROUP>
95+
name: <YOUR_CONTAINER_APP_NAME>
96+
revision-name-suffix: <SHORT_HASH>
97+
image: <YOUR_CONTAINER_IMAGE>
98+
deactivate-revision-mode: true #IMPORTANT!!
99+
100+
- name: Find Comment
101+
uses: peter-evans/find-comment@v2
102+
id: fc
109103
with:
110-
```
104+
issue-number: ${{ github.event.pull_request.number }}
105+
comment-author: "github-actions[bot]"
106+
body-includes: Revision ${{ env.CONTAINERAPP_NAME }}--${{ env.SHORT_HASH }} is created.
111107

112-
#### Create and Deactivate an action
113-
114-
```yaml
115-
on: [push, pull_request]
116-
name: Preview Deployment
117-
jobs:
118-
build-and-deploy:
119-
runs-on: ubuntu-latest
120-
env:
121-
RESOURCE_GROUP: <YOUR_RESOURCE_GROUP_NAME>
122-
CONTAINER_APP_NAME: <YOUR_CONTAINER_APP_NAME>
123-
DOCKER_IMAGE_NAME: <YOUR_DOCKER_IMAGE_NAME>
124-
steps:
125-
- name: 'Checkout GitHub Action'
126-
uses: actions/checkout@master
127-
- name: 'Login via Azure CLI'
128-
uses: azure/login@v1
129-
with:
130-
creds: ${{ secrets.AZURE_CREDENTIALS }}
131-
# Revision Creation
132-
- name: 'Create a new Container App revision'
133-
uses: azure/[email protected]
134-
with:
135-
resource-group: ${{ env.RESOURCE_GROUP }}
136-
name: ${{ env.CONTAINER_APP_NAME }}
137-
image: ${{ env.DOCKER_IMAGE_NAME }}
138-
# Revision Deactivation
139-
- name: Deactivate Preview Deployment
140-
if: github.event.action == 'closed'
141-
uses: azure/[email protected]
142-
with:
143-
deactivate-revision-mode: ture
144-
resource-group: ${{ env.RESOURCE_GROUP }}
145-
name: ${{ env.CONTAINER_APP_NAME }}
146-
image: ${{ env.DOCKER_IMAGE_NAME }}
108+
- name: add new comment to PR
109+
if: steps.fc.outputs.comment-id != ''
110+
uses: peter-evans/create-or-update-comment@v2
111+
with:
112+
comment-id: ${{ steps.fc.outputs.comment-id }}
113+
edit-mode: replace
114+
body: |
115+
Revision ${{ env.CONTAINERAPP_NAME }}--${{ env.SHORT_HASH }} is deactivated.
147116
```
148117
149-
### How to develop/test this Action
118+
### How to Develop/Test this Action
150119
151120
#### Debug with breakpoints on Visual Studio Code
152121
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)