|
| 1 | +name: release-automated |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ master, alpha, beta, next-major ] |
| 5 | +jobs: |
| 6 | + release: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - uses: actions/checkout@v2 |
| 10 | + with: |
| 11 | + persist-credentials: false |
| 12 | + - uses: actions/setup-node@v2 |
| 13 | + with: |
| 14 | + node-version: 12 |
| 15 | + registry-url: https://registry.npmjs.org/ |
| 16 | + - name: Cache Node.js modules |
| 17 | + uses: actions/cache@v2 |
| 18 | + with: |
| 19 | + path: ~/.npm |
| 20 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 21 | + restore-keys: | |
| 22 | + ${{ runner.os }}-node- |
| 23 | + - run: npm ci |
| 24 | + - run: npx semantic-release |
| 25 | + env: |
| 26 | + GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} |
| 27 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 28 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 29 | + |
| 30 | + docker: |
| 31 | + needs: release |
| 32 | + env: |
| 33 | + REGISTRY: docker.io |
| 34 | + IMAGE_NAME: parseplatform/parse-dashboard |
| 35 | + runs-on: ubuntu-18.04 |
| 36 | + permissions: |
| 37 | + contents: read |
| 38 | + packages: write |
| 39 | + steps: |
| 40 | + - name: Determine branch name |
| 41 | + id: branch |
| 42 | + run: echo "::set-output name=branch_name::${GITHUB_REF#refs/*/}" |
| 43 | + - name: Checkout repository |
| 44 | + uses: actions/checkout@v2 |
| 45 | + - name: Set up QEMU |
| 46 | + id: qemu |
| 47 | + uses: docker/setup-qemu-action@v1 |
| 48 | + - name: Set up Docker Buildx |
| 49 | + uses: docker/setup-buildx-action@v1 |
| 50 | + - name: Log into Docker Hub |
| 51 | + if: github.event_name != 'pull_request' |
| 52 | + uses: docker/login-action@v1 |
| 53 | + with: |
| 54 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 55 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 56 | + - name: Extract Docker metadata |
| 57 | + id: meta |
| 58 | + uses: docker/metadata-action@v3 |
| 59 | + with: |
| 60 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 61 | + flavor: | |
| 62 | + latest=${{ steps.branch.outputs.branch_name == 'master' }} |
| 63 | + - name: Build and push Docker image |
| 64 | + uses: docker/build-push-action@v2 |
| 65 | + with: |
| 66 | + context: . |
| 67 | + platforms: linux/amd64 |
| 68 | + push: ${{ github.event_name != 'pull_request' }} |
| 69 | + tags: ${{ steps.meta.outputs.tags }} |
| 70 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments