From 0aa6608265d7ba92bce5895586e6691d9fbb666d Mon Sep 17 00:00:00 2001 From: Matt <7128721+TobiTenno@users.noreply.github.com> Date: Sun, 5 Jan 2025 18:29:58 -0600 Subject: [PATCH] feat: dockerize release (#15) publish api image to ghcr --- .github/workflows/release.yaml | 55 +++++++++++++++++++++------------- .releaserc.yaml | 21 +++++++++++++ 2 files changed, 56 insertions(+), 20 deletions(-) create mode 100644 .releaserc.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 08a1e54..6ec0230 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -8,27 +8,42 @@ 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 + + - 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: - node-version: ${{ matrix.node-version }} + 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 + + - name: Release + uses: cycjimmy/semantic-release-action@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + extra_plugins: | + @eclass/semantic-release-docker + @semantic-release/git + @semantic-release/changelog + @semantic-release/exec diff --git a/.releaserc.yaml b/.releaserc.yaml new file mode 100644 index 0000000..868a6c5 --- /dev/null +++ b/.releaserc.yaml @@ -0,0 +1,21 @@ +plugins: + - '@semantic-release/commit-analyzer' + - - '@semantic-release/exec' + - successCmd: echo 'yes' >> .release + failCmd: echo 'no' >> .release + - '@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_USER + password: GITHUB_TOKEN +branches: main