Skip to content

Commit

Permalink
feat: build and push docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
k.mesniankin committed Oct 5, 2024
1 parent 301417f commit 191d53e
Showing 1 changed file with 50 additions and 10 deletions.
60 changes: 50 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,72 @@ on:
push:
branches: [main]
jobs:
release:
name: Release
# build and test code, up version, create release in github
gh-release:
name: GitHub Release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.release.outputs.version }}
steps:
# Checkout
# checkout
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # to fetch all history for all branches and tags
# Setup node.js
# setup node.js
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
# Dependencies
# dependencies
- name: Dependencies
run: yarn install --immutable
# Lint
# lint
- name: Lint
run: yarn lint
# Build
# build
- name: Build
run: yarn build
# Release
- name: Release
# release
- id: release
name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn semantic-release
run: |
yarn semantic-release
echo 'version=$(npm pkg get version | tr -d \")' >> $GITHUB_OUTPUT
# upload build artifacts for reuse them later
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: |
dist
package.json
# build and push docker image
docker:
name: Docker
needs: [gh-release]
runs-on: ubuntu-latest
steps:
# checkout
- name: Checkout
uses: actions/checkout@v4
# download build artifacts
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: build
# setup docker buildx
- name: Setup docker buildx
uses: docker/setup-buildx-action@v3
# build and push
- name: Build and push
uses: docker/build-push-action@v6
with:
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ needs.gh-release.outputs.version }}

0 comments on commit 191d53e

Please sign in to comment.