【Auto-build】quick-start #9
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: Build wasi image by cirun | |
on: | |
issue_comment: | |
types: | |
- created | |
jobs: | |
resolve-issue-var: | |
if: startswith(github.event.comment.body, '/imagebuild_cirun_apps') && github.event.sender.login=='cuisongliu' | |
runs-on: ubuntu-latest | |
outputs: | |
app: ${{ steps.set-appversion.outputs.app }} | |
version: ${{ steps.set-appversion.outputs.version }} | |
steps: | |
- name: Write vars | |
id: set-appversion | |
run: | | |
commentbody="${{github.event.comment.body}}" | |
app=`echo "$commentbody"| awk '{print $2}'` | |
version=`echo "$commentbody"| awk '{print $3}'` | |
echo "app=$app" >> $GITHUB_OUTPUT | |
echo "version=$version" >> $GITHUB_OUTPUT | |
build-wasi: | |
name: Auto build app image | |
needs: | |
- resolve-issue-var | |
runs-on: cirun-gcp-amd64--${{ github.run_id }} | |
permissions: | |
issues: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download buildah and sealos | |
run: .github/scripts/download.sh | |
- name: Build Image | |
env: | |
registry: ${{ vars.D_REGISTRY_NAME }} | |
username: ${{ vars.D_REGISTRY_REPOSITORY }} | |
repo: ${{ vars.D_REGISTRY_REPOSITORY }} | |
password: ${{ secrets.D_REGISTRY_TOKEN }} | |
app: ${{ needs.resolve-issue-var.outputs.app }} | |
version: ${{ needs.resolve-issue-var.outputs.version }} | |
run: .github/scripts/apps.sh | |
add-tips: | |
if: contains(github.event.comment.body, 'imagebuild') | |
needs: | |
- resolve-issue-var | |
- build-wasi | |
name: Auto add tips | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- name: Success Commit | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
``` | |
image ${{ vars.D_REGISTRY_NAME }}/${{ vars.D_REGISTRY_REPOSITORY }}/${{ needs.resolve-issue-var.outputs.app }}:${{ needs.resolve-issue-var.outputs.version }} build successfully! | |
``` | |
See: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |