| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- name: Release
- on:
- pull_request:
- branches:
- - release/current
- - release/*.*.*
- types: [closed]
- jobs:
- create-github-release:
- runs-on: ubuntu-latest
- if: github.event.pull_request.merged == true
- outputs:
- RELEASED_VERSION: ${{ steps.package-json.outputs.packageVersion }}
- steps:
- - uses: actions/checkout@v2
- with:
- ref: ${{ github.event.pull_request.base.ref }}
- - uses: actions/setup-node@v2
- with:
- node-version: '14'
- cache: 'yarn'
- cache-dependency-path: '**/yarn.lock'
- - name: Install dependencies
- run: |
- npx lerna bootstrap
- - name: Bump versions
- run: |
- node ./bin/github-actions/bump-versions -i patch
- sh ./packages/app/bin/github-actions/update-readme.sh
- - name: Retrieve information from package.json
- uses: myrotvorets/info-from-package-json-action@1.1.0
- id: package-json
- - name: Update Changelog
- uses: stefanzweifel/changelog-updater-action@v1
- with:
- latest-version: v${{ steps.package-json.outputs.packageVersion }}
- release-notes: ${{ github.event.pull_request.body }}
- - name: Update README.md for docker image
- working-directory: ./packages/app
- run: |
- sh ./bin/github-actions/update-readme.sh
- env:
- RELEASED_VERSION: ${{ steps.package-json.outputs.packageVersion }}
- - name: Commit, Tag and Push
- uses: stefanzweifel/git-auto-commit-action@v4
- with:
- branch: ${{ github.event.pull_request.base.ref }}
- commit_message: Release v${{ steps.package-json.outputs.packageVersion }}
- tagging_message: v${{ steps.package-json.outputs.packageVersion }}
- - uses: ncipollo/release-action@v1
- with:
- body: ${{ github.event.pull_request.body }}
- tag: v${{ steps.package-json.outputs.packageVersion }}
- token: ${{ secrets.GITHUB_TOKEN }}
- - name: Delete drafts
- uses: hugo19941994/delete-draft-releases@v1.0.0
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- create-pr-for-next-rc:
- needs: create-github-release
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- with:
- ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
- - uses: actions/setup-node@v2
- with:
- node-version: '14'
- cache: 'yarn'
- cache-dependency-path: '**/yarn.lock'
- - name: Install dependencies
- run: |
- npx lerna bootstrap
- - name: Bump versions for next RC
- run: |
- node ./bin/github-actions/bump-versions -i prerelease
- node ./bin/github-actions/bump-versions -i prerelease -d packages/slackbot-proxy --preid slackbot-proxy --update-dependencies false
- - name: Retrieve information from package.json
- uses: myrotvorets/info-from-package-json-action@1.1.0
- id: package-json
- - name: Commit
- uses: github-actions-x/commit@v2.8
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
- commit-message: 'Bump version'
- name: GitHub Action
- - name: Create PR
- uses: repo-sync/pull-request@v2
- with:
- source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
- destination_branch: master
- pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
- pr_label: exclude from changelog
- pr_body: "An automated PR generated by ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
- github_token: ${{ secrets.GITHUB_TOKEN }}
- build-image:
- needs: create-github-release
- runs-on: ubuntu-latest
- strategy:
- matrix:
- flavor: [default, nocdn]
- steps:
- - uses: actions/checkout@v2
- with:
- ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
- - name: Setup suffix
- id: suffix
- run: |
- [[ ${{ matrix.flavor }} = "nocdn" ]] && suffix="-nocdn" || suffix=""
- echo "::set-output name=SUFFIX::$suffix"
- - name: Docker meta
- id: meta
- uses: docker/metadata-action@v3
- with:
- images: weseek/growi,ghcr.io/weseek/growi
- flavor: |
- suffix=${{ steps.suffix.outputs.SUFFIX }}
- tags: |
- type=raw,value=latest
- type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}
- type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}
- type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
- - name: Login to docker.io registry
- run: |
- echo ${{ secrets. DOCKER_REGISTRY_PASSWORD }} | docker login --username wsmoogle --password-stdin
- - name: Login to GitHub Container Registry
- uses: docker/login-action@v1
- with:
- registry: ghcr.io
- username: wsmoogle
- password: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v1
- - name: Cache Docker layers
- uses: actions/cache@v2
- with:
- path: /tmp/.buildx-cache
- key: ${{ runner.os }}-buildx-app-${{ matrix.flavor }}-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-buildx-app-${{ matrix.flavor }}-
- ${{ runner.os }}-buildx-app-
- - name: Build and push
- uses: docker/build-push-action@v2
- with:
- context: .
- file: ./packages/app/docker/Dockerfile
- platforms: linux/amd64
- push: true
- build-args: |
- flavor=${{ matrix.flavor }}
- cache-from: type=local,src=/tmp/.buildx-cache
- cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
- tags: ${{ steps.meta.outputs.tags }}
- - name: Move cache
- run: |
- rm -rf /tmp/.buildx-cache
- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- - name: Update Docker Hub Description
- uses: peter-evans/dockerhub-description@v2
- with:
- username: wsmoogle
- password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- repository: weseek/growi
- readme-filepath: ./packages/app/docker/README.md
- - name: Slack Notification
- uses: weseek/ghaction-release-slack-notification@master
- with:
- channel: '#release'
- url: ${{ secrets.SLACK_WEBHOOK_URL }}
- created_tag: 'v${{ needs.create-github-release.outputs.RELEASED_VERSION }}${{ steps.suffix.outputs.SUFFIX }}'
- - name: Check whether workspace is clean
- run: |
- STATUS=`git status --porcelain`
- if [ -z "$STATUS" ]; then exit 0; else exit 1; fi
|