name: release on: push: tags: - 'v*' jobs: github: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - run: make release - uses: actions/github-script@v6 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const fs = require('fs').promises; const { repo: { owner, repo } } = context; const currentRelease = context.ref.split('/')[2]; let res = await github.rest.repos.getLatestRelease({ owner, repo, }); const previousRelease = res.data['tag_name']; res = await github.rest.repos.compareCommitsWithBasehead({ owner, repo, basehead: `${previousRelease}...${currentRelease}`, }); const messages = []; for (const commit of res.data.commits) { messages.push(`* ${commit.commit.message} ${commit.html_url}`); } res = await github.rest.repos.createRelease({ owner, repo, tag_name: currentRelease, name: currentRelease, body: `Commits:\n${messages.join('\n')}\n`, }); const release_id = res.data.id; for (const name of await fs.readdir('./release/')) { await github.rest.repos.uploadReleaseAsset({ owner, repo, release_id, name, data: await fs.readFile(`./release/${name}`), }); } dockerhub: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - run: make dockerhub env: DOCKER_USER: ${{ secrets.DOCKER_USER }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} apidocs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - run: make apidocs-gen - run: mv apidocs/*.html apidocs/index.html - uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./apidocs