Skip to content

Commit

Permalink
feat: revamp build process
Browse files Browse the repository at this point in the history
- update semantic-release workflow to reflect new assets
- remove all previous docker-related build process
- add a new auto-generated command reference file
  • Loading branch information
kanadgupta committed Nov 18, 2024
1 parent 66f9f87 commit ea2548f
Show file tree
Hide file tree
Showing 11 changed files with 535 additions and 196 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# test result artifacts
coverage/

# release build artifacts
dist/
dist-gha/
31 changes: 0 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,6 @@ jobs:
- name: Install semantic-release and friends
run: npm i --no-save semantic-release@24 @semantic-release/changelog@6 @semantic-release/exec@6 @semantic-release/git@10

# We do a dry run here to analyze the commits and grab the next version
# for usage in the Docker metadata action
- name: Dry run of semantic-release workflow
run: npx semantic-release --dry-run
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# For every release we add 2-3 tags to the docker build:
# 1. A semver tag (e.g., 8.0.0, 8.0.0-next.0)
# 2. A branch tag (e.g., next, main)
# 3. A `latest` tag (only on the main branch)
tags: |
type=semver,pattern={{version}},value=${{ steps.release.outputs.nextVersion }}
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: Run semantic-release workflow
env:
GH_TOKEN: ${{ secrets.RELEASE_GH_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ node_modules/

# required for building with TS + oclif + GitHub Actions
dist-gha/package.json
oclif.manifest.json
src/package.json
8 changes: 7 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# invalid files
__tests__/__fixtures__/invalid-json/yikes.json
CHANGELOG.md

# test result artifacts
coverage/

# release build artifacts
CHANGELOG.md
dist/
documentation/commands.md
dist-gha/
20 changes: 9 additions & 11 deletions .releaserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ plugins:
- [
'@semantic-release/exec',
{
# Runs two commands:
# 1. Updates our action.yml file to reflect current Docker image version.
# This needs to happen before `@semantic-release/git` so we can commit this file.
# 2. Builds and pushes the Docker image
'prepareCmd': './bin/set-action-image.js && ./bin/docker.js',
# Adds a major version git tag (e.g., v8) as a convenience for GitHub Actions users
# We need to run this in the publish phase so it can be force-pushed separately from the other tags
'publishCmd': './bin/set-major-version-tag.js push',
Expand All @@ -28,18 +23,21 @@ plugins:
- [
'@semantic-release/git',
{
assets: ['action.yml', 'CHANGELOG.md', 'package.json', 'package-lock.json'],
assets:
[
'CHANGELOG.md',
'documentation/commands.md',
'package.json',
'package-lock.json',
'dist-gha/commands.js',
'dist-gha/run.js',
],
message: "build(release): 🚀 v${nextRelease.version} 🦉\n\n${nextRelease.notes}\n[skip ci]",
},
]
- [
'@semantic-release/exec',
{
# Verify existence of docker CLI
'verifyConditionsCmd': './bin/verify-clis.sh',
# Sets the next version as a GitHub Actions output parameter for usage in subsequent workflow steps
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
'verifyReleaseCmd': 'echo nextVersion=${nextRelease.version} >> $GITHUB_OUTPUT',
# Adds an additional git tag without the `v` prefix as a convenience for GitHub Actions users
'prepareCmd': 'git tag ${nextRelease.version}',
},
Expand Down
11 changes: 0 additions & 11 deletions Dockerfile

This file was deleted.

100 changes: 0 additions & 100 deletions bin/docker.js

This file was deleted.

31 changes: 0 additions & 31 deletions bin/set-action-image.js

This file was deleted.

10 changes: 0 additions & 10 deletions bin/verify-clis.sh

This file was deleted.

Loading

0 comments on commit ea2548f

Please sign in to comment.