|
| 1 | +name: release-automated |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ release, alpha, beta, next-major, release-4.x.x ] |
| 5 | +jobs: |
| 6 | + release: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + outputs: |
| 9 | + current_tag: ${{ steps.tag.outputs.current_tag }} |
| 10 | + trigger_branch: ${{ steps.branch.outputs.trigger_branch }} |
| 11 | + steps: |
| 12 | + - name: Determine trigger branch name |
| 13 | + id: branch |
| 14 | + run: echo "::set-output name=trigger_branch::${GITHUB_REF#refs/*/}" |
| 15 | + - uses: actions/checkout@v2 |
| 16 | + with: |
| 17 | + persist-credentials: false |
| 18 | + - uses: actions/setup-node@v2 |
| 19 | + with: |
| 20 | + node-version: 14 |
| 21 | + registry-url: https://registry.npmjs.org/ |
| 22 | + - name: Cache Node.js modules |
| 23 | + uses: actions/cache@v2 |
| 24 | + with: |
| 25 | + path: ~/.npm |
| 26 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 27 | + restore-keys: | |
| 28 | + ${{ runner.os }}-node- |
| 29 | + - run: npm ci |
| 30 | + - run: npx semantic-release |
| 31 | + env: |
| 32 | + GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} |
| 33 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 35 | + - name: Determine tag on current commit |
| 36 | + id: tag |
| 37 | + run: echo "::set-output name=current_tag::$(git describe --tags --abbrev=0 --exact-match || echo '')" |
| 38 | + |
| 39 | + docker: |
| 40 | + needs: release |
| 41 | + if: needs.release.outputs.current_tag != '' |
| 42 | + env: |
| 43 | + REGISTRY: docker.io |
| 44 | + IMAGE_NAME: parseplatform/parse-server |
| 45 | + runs-on: ubuntu-18.04 |
| 46 | + permissions: |
| 47 | + contents: read |
| 48 | + packages: write |
| 49 | + steps: |
| 50 | + - name: Determine branch name |
| 51 | + id: branch |
| 52 | + run: echo "::set-output name=branch_name::${GITHUB_REF#refs/*/}" |
| 53 | + - name: Checkout repository |
| 54 | + uses: actions/checkout@v2 |
| 55 | + with: |
| 56 | + ref: ${{ needs.release.outputs.current_tag }} |
| 57 | + - name: Set up QEMU |
| 58 | + id: qemu |
| 59 | + uses: docker/setup-qemu-action@v1 |
| 60 | + - name: Set up Docker Buildx |
| 61 | + uses: docker/setup-buildx-action@v1 |
| 62 | + - name: Log into Docker Hub |
| 63 | + if: github.event_name != 'pull_request' |
| 64 | + uses: docker/login-action@v1 |
| 65 | + with: |
| 66 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 67 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 68 | + - name: Extract Docker metadata |
| 69 | + id: meta |
| 70 | + uses: docker/metadata-action@v3 |
| 71 | + with: |
| 72 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 73 | + flavor: | |
| 74 | + latest=${{ steps.branch.outputs.branch_name == 'release' }} |
| 75 | + tags: | |
| 76 | + type=semver,pattern={{version}},value=${{ needs.release.outputs.current_tag }} |
| 77 | + - name: Build and push Docker image |
| 78 | + uses: docker/build-push-action@v2 |
| 79 | + with: |
| 80 | + context: . |
| 81 | + platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8 |
| 82 | + push: ${{ github.event_name != 'pull_request' }} |
| 83 | + tags: ${{ steps.meta.outputs.tags }} |
| 84 | + labels: ${{ steps.meta.outputs.labels }} |
| 85 | + |
| 86 | + docs: |
| 87 | + needs: release |
| 88 | + if: needs.release.outputs.current_tag != '' && github.ref == 'refs/heads/release' |
| 89 | + runs-on: ubuntu-18.04 |
| 90 | + timeout-minutes: 15 |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v2 |
| 93 | + - name: Use Node.js |
| 94 | + uses: actions/setup-node@v1 |
| 95 | + with: |
| 96 | + node-version: 14 |
| 97 | + - name: Cache Node.js modules |
| 98 | + uses: actions/cache@v2 |
| 99 | + with: |
| 100 | + path: ~/.npm |
| 101 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 102 | + restore-keys: | |
| 103 | + ${{ runner.os }}-node- |
| 104 | + - name: Generate Docs |
| 105 | + run: | |
| 106 | + echo $SOURCE_TAG |
| 107 | + npm ci |
| 108 | + ./release_docs.sh |
| 109 | + env: |
| 110 | + SOURCE_TAG: ${{ needs.release.outputs.current_tag }} |
| 111 | + - name: Deploy |
| 112 | + |
| 113 | + with: |
| 114 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 115 | + publish_dir: ./docs |
0 commit comments