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

Deploy document on release by github actions #526

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 10 additions & 3 deletions .github/workflows/diff-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ jobs:
export PATH=$PATH:~/bin/openapitools/
OPENAPI_GENERATOR_VERSION=${{ env.OPENAPI_GENERATOR_VERSION }} openapi-generator-cli version

# Generate codes
- run: |
- name: Generate codes
run: |
export PATH=$PATH:~/bin/openapitools/
bash tools/gen-oas-client.sh
- name: Update document
run: |
wget https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.3.1/phpDocumentor.phar
php phpDocumentor.phar run -d src -t docs
- run: |
diff=$(git --no-pager diff --name-only HEAD)
echo "DIFF_IS_EMPTY=$([[ -z "$diff" ]] && echo 'true' || echo 'false')" >> $GITHUB_ENV
Expand All @@ -59,7 +63,10 @@ jobs:

git add line-openapi
git add src/**
git commit -m "Codes are generated by openapi"
git commit --allow-empty -m "Codes are generated by openapi generator"

git add docs/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff-check.yml: Just reverting 8123ba2

git commit --allow-empty -m "Update document"

git push origin update-diff-${{ env.CURRENT_DATETIME }}
gh pr create -B ${{ github.ref_name }} -t "Codes are generated by openapi generator" -b "" --label "line-openapi-update"
Expand Down
68 changes: 34 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
name: On release
name: Deploy static content to Pages on release

on:
release:
types: [created]
types: [ created ]
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write


# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false


jobs:
deploy-docs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
# Setup
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Update submodules
run: git submodule update --remote --recursive
- uses: actions/setup-node@v3
id: setup_node_id
with:
node-version: 18
- uses: shivammathur/setup-php@v2
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
php-version: 8.2

# Update document
- name: Update document
run: |
wget https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.3.1/phpDocumentor.phar
php phpDocumentor.phar run -d src -t docs
- run: |
diff=$(git --no-pager diff --name-only HEAD)
echo "DIFF_IS_EMPTY=$([[ -z "$diff" ]] && echo 'true' || echo 'false')" >> $GITHUB_ENV

- if: ${{ env.DIFF_IS_EMPTY != 'true' }}
run: |
git config user.name github-actions
git config user.email [email protected]
git add docs/**
git commit --allow-empty -m "Update document for release (${{ github.event.release.tag_name }})"
git push origin master
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
path: 'docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2