Skip to content

Commit

Permalink
feat: dockerize release (#15)
Browse files Browse the repository at this point in the history
publish api image to ghcr
  • Loading branch information
TobiTenno committed Jan 7, 2025
1 parent d969ede commit a62937c
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 42 deletions.
57 changes: 37 additions & 20 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,44 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['12', '14', '16', 'lts/*']
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- uses: actions/checkout@v4
with:
node-version: ${{ matrix.node-version }}
persist-credentials: false

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PACKAGES_TOKEN }}

- run: npm ci
- run: npm run lint
# TODO: get this working
# - name: Release
# uses: cycjimmy/semantic-release-action@v3
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# DOCKER_USERNAME: ${{ github.token }}
# with:
# semantic_version: 17
# extra_plugins: |
# @eclass/semantic-release-docker
# @semantic-release/git
# @semantic-release/changelog
# @semantic-release/exec

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
tags: ghcr.io/libreweather/libre-weather-api:latest

- name: Release
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
with:
extra_plugins: |
@eclass/semantic-release-docker
@semantic-release/git
@semantic-release/changelog
18 changes: 18 additions & 0 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
plugins:
- '@semantic-release/commit-analyzer'
- '@semantic-release/release-notes-generator'
- - '@semantic-release/npm'
- npmPublish: false
- '@semantic-release/github'
- - '@semantic-release/git'
- assets:
- package.json
- CHANGELOG.md
- - '@eclass/semantic-release-docker'
- baseImageName: libre-weather-api
registries:
- url: ghcr.io
imageName: ghcr.io/libreweather/libre-weather-api
user: GITHUB_ACTOR
password: GITHUB_TOKEN
branches: main
22 changes: 0 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,27 +134,5 @@
},
"engines": {
"node": "=14.9.0"
},
"release": {
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/npm", {
"npmPublish": false
}],
["@semantic-release/github", {
"assets": ["package.json", "package-lock.json"]
}],
["@semantic-release/exec", {
"prepareCmd": "docker build -t libreweather/libreweather-api ."
}],
["@eclass/semantic-release-docker", {
"baseImageName": "libreweather-api",
"registries": [{
"url": "docker.pkg.github.com",
"imageName": "docker.pkg.github.com/libreweather/libreweather-api"
}]
}]
]
}
}

0 comments on commit a62937c

Please sign in to comment.