Skip to content

Commit

Permalink
chore(release): prepare for 0.1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
kruserr committed Oct 8, 2024
1 parent f7abe66 commit 46e1fe0
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 154 deletions.
83 changes: 0 additions & 83 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
tags:
- "v*.*.*"

env:
IMAGE_NAME: i6
IMAGE_LATEST: docker.pkg.github.com/kruserr/i6/i6:latest

jobs:
rustfmt:
name: Formatting
Expand Down Expand Up @@ -80,82 +76,3 @@ jobs:
- name: Publish
run: |
cargo publish --token ${{ secrets.CARGO_TOKEN }}
publish-docker:
name: Publish on GitHub Packages and Docker Hub
needs:
- rustfmt
- clippy
- test
runs-on: ubuntu-22.04
if: github.event_name == 'push'
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build image
run: |
docker build \
--cache-from $IMAGE_LATEST \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag $IMAGE_NAME .
- name: Login to GitHub Packages
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Push image to GitHub Packages
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Strip patch version from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION_MINOR=${VERSION%.*}
# Strip minor version from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION_MAJOR=${VERSION_MINOR%.*}
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION_MINOR
docker push $IMAGE_ID:$VERSION_MINOR
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION_MAJOR
docker push $IMAGE_ID:$VERSION_MAJOR
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login docker.io -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Push image to Docker Hub
run: |
IMAGE_ID=docker.io/${{ github.repository }}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Strip patch version from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION_MINOR=${VERSION%.*}
# Strip minor version from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION_MAJOR=${VERSION_MINOR%.*}
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION_MINOR
docker push $IMAGE_ID:$VERSION_MINOR
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION_MAJOR
docker push $IMAGE_ID:$VERSION_MAJOR
49 changes: 0 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ on:
branches:
- main

env:
IMAGE_NAME: i6
IMAGE_LATEST: docker.pkg.github.com/kruserr/i6/i6:latest

jobs:
rustfmt:
name: Formatting
Expand Down Expand Up @@ -43,48 +39,3 @@ jobs:
uses: Swatinem/rust-cache@v2
- name: Test
run: cargo test

publish-docker:
name: Publish on GitHub Packages and Docker Hub
runs-on: ubuntu-22.04
if: github.event_name == 'push'
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build image
run: |
docker build \
--cache-from $IMAGE_LATEST \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag $IMAGE_NAME .
- name: Login to GitHub Packages
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Push image to GitHub Packages
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Use Docker `latest` tag convention
VERSION=latest
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login docker.io -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Push image to Docker Hub
run: |
IMAGE_ID=docker.io/${{ github.repository }}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Use Docker `latest` tag convention
VERSION=latest
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

All notable changes to this project will be documented in this file.

## [0.1.10] - 2024-10-08

### Bug Fixes

- Update name

### Features

- Add pack command

### Miscellaneous Tasks

- Init i6-pack migration
- Init i6-pack migration
- Set up workspace
- Set up workspace
- Bump version to 0.1.10
- Update deps

### Styling

- Fmt

## [0.1.9] - 2024-09-22

### Ci
Expand Down
12 changes: 0 additions & 12 deletions Dockerfile

This file was deleted.

File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions cliff.toml → tooling/cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
tag_pattern = "[0-9]*"
# regex for skipping tags
skip_tags = "v0.1.0-beta.1"
skip_tags = "0.1.0-beta.1"
# regex for ignoring tags
ignore_tags = ""
# sort the tags chronologically
Expand Down
4 changes: 2 additions & 2 deletions git-cliff-detailed.toml → tooling/git-cliff-detailed.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
tag_pattern = "[0-9]*"
# regex for skipping tags
skip_tags = "v0.1.0-beta.1"
skip_tags = "0.1.0-beta.1"
# regex for ignoring tags
ignore_tags = ""
# sort the tags chronologically
Expand Down
19 changes: 13 additions & 6 deletions prepare_release.sh → tooling/prepare_release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/usr/bin/env bash

# Example
# ```sh
# ./prepare_release.sh 0.1.25
# ```

set -Eeuo pipefail

ci () {
Expand All @@ -8,9 +14,10 @@ ci () {
}

bump_version () {
# update the Cargo.toml version of the workspace
# update the Cargo.toml version of the workspaces
msg="# prepare_release.sh"
sed "s/^version = .* $msg$/version = \"${1#v}\" $msg/" -i Cargo.toml

sed "s/^version = .* $msg$/version = \"${1#v}\" $msg/" -i i6/Cargo.toml

cargo check
}
Expand All @@ -24,7 +31,7 @@ prepare_tag () {
- {% if commit.breaking %}(breaking) {% endif %}{{ commit.message | upper_first }} ({{ commit.id | truncate(length=7, end=\"\") }})\
{% endfor %}
{% endfor %}"
changelog=$(git-cliff --config git-cliff-detailed.toml --unreleased --strip all)
changelog=$(git-cliff --config tooling/git-cliff-detailed.toml --unreleased --strip all)

git add -A && git commit -m "chore(release): prepare for $1"

Expand All @@ -33,15 +40,15 @@ prepare_tag () {
git tag -v "$1"
}

# takes the tag as an argument (e.g. v0.1.0)
# takes the tag as an argument (e.g. 0.1.0)
if [ -n $1 ]; then
if [ $1 == "init" ]; then
if [ -n $2 ]; then
ci

bump_version $2

git-cliff --tag "$2" > CHANGELOG.md
git-cliff --config tooling/cliff.toml --tag "$2" > CHANGELOG.md

prepare_tag $2
else
Expand All @@ -52,7 +59,7 @@ if [ -n $1 ]; then

bump_version $1

git-cliff --unreleased --tag "$1" --prepend CHANGELOG.md
git-cliff --config tooling/cliff.toml --unreleased --tag "$1" --prepend CHANGELOG.md

prepare_tag $1
fi
Expand Down

0 comments on commit 46e1fe0

Please sign in to comment.