Skip to content

Commit

Permalink
chore(ci): Comment push and dependabot steps
Browse files Browse the repository at this point in the history
  • Loading branch information
zapling committed Nov 18, 2024
1 parent abd63cf commit 14e0376
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 109 deletions.
186 changes: 93 additions & 93 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,96 +137,96 @@ jobs:
- name: Run make test
run: docker compose run --rm dev make test

- name: Login to Docker Hub
uses: docker/login-action@v3
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate Docker image tags
id: meta
uses: docker/metadata-action@v5
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Publish Docker image
uses: docker/build-push-action@v6
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
with:
context: .
target: release
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

npm:
name: NPM
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
cache: npm
cache-dependency-path: typescript/package-lock.json

- uses: actions/download-artifact@v4
with:
path: dist

- run: find dist

- run: npm ci
working-directory: typescript

- run: npm run lint:ci
working-directory: typescript

- run: npm run generate
working-directory: typescript

- run: npm run publish
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
working-directory: typescript
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

dependabot:
name: Dependabot
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Automatically approve dependabot PRs
uses: octokit/[email protected]
with:
route: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews
owner: ${{ github.event.repository.owner.login }}
repo: ${{ github.event.repository.name }}
pull_number: ${{ github.event.pull_request.number }}
event: APPROVE
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Login to Docker Hub
# uses: docker/login-action@v3
# if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Generate Docker image tags
# id: meta
# uses: docker/metadata-action@v5
# if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
# with:
# images: |
# ${{ github.repository }}
# ghcr.io/${{ github.repository }}
# tags: |
# type=ref,event=branch
# type=semver,pattern={{version}}
# type=semver,pattern={{major}}.{{minor}}
# type=semver,pattern={{major}}
#
# - name: Publish Docker image
# uses: docker/build-push-action@v6
# if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
# with:
# context: .
# target: release
# platforms: linux/amd64,linux/arm64
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}

# npm:
# name: NPM
# runs-on: ubuntu-latest
# needs: build
#
# steps:
# - uses: actions/checkout@v4
#
# - uses: actions/setup-node@v4
# with:
# node-version: 20
# registry-url: https://registry.npmjs.org
# cache: npm
# cache-dependency-path: typescript/package-lock.json
#
# - uses: actions/download-artifact@v4
# with:
# path: dist
#
# - run: find dist
#
# - run: npm ci
# working-directory: typescript
#
# - run: npm run lint:ci
# working-directory: typescript
#
# - run: npm run generate
# working-directory: typescript
#
# - run: npm run publish
# if: ${{ startsWith(github.ref, 'refs/tags/v') }}
# working-directory: typescript
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

# dependabot:
# name: Dependabot
# runs-on: ubuntu-latest
# permissions:
# pull-requests: write
# if: github.event.pull_request.user.login == 'dependabot[bot]'
# steps:
# - name: Automatically approve dependabot PRs
# uses: octokit/[email protected]
# with:
# route: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews
# owner: ${{ github.event.repository.owner.login }}
# repo: ${{ github.event.repository.name }}
# pull_number: ${{ github.event.pull_request.number }}
# event: APPROVE
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 0 additions & 16 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit 14e0376

Please sign in to comment.