Skip to content

Commit

Permalink
自動でプッシュまで行う
Browse files Browse the repository at this point in the history
  • Loading branch information
takecchi committed Sep 23, 2023
1 parent 7d74bdc commit d24db02
Show file tree
Hide file tree
Showing 8 changed files with 1,679 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: build and publish package

on:
release:
types: [created]

jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
actions: write
checks: write
contents: write
deployments: write
issues: write
packages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com/

- name: Install openapi-generator-cli
run: npm install -g @openapitools/openapi-generator-cli

- name: Generate src
run: openapi-generator-cli generate -i ./docs/cuculus-openapi.yaml -g typescript-fetch -o ./src -c ./config.json

- name: Update package.json version
uses: jossef/action-set-json-field@v1
with:
file: ./package.json
field: version
value: ${{ github.event.release.name }}

- name: Commit and push
run: |
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add src/
git commit -m "$(date +'%Y-%m-%d') Update"
git push origin HEAD:${GITHUB_REF}
- name: Package install
run: npm install

- name: Publish package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# IDE
.idea

# generated
src/.openapi-generator
src/.openapi-generator-ignore
openapitools.json

# build
dist
Binary file modified README.md
Binary file not shown.
2 changes: 2 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
Loading

0 comments on commit d24db02

Please sign in to comment.