Skip to content

Commit

Permalink
Add RELEASE.md
Browse files Browse the repository at this point in the history
In particular, I'd like to make sure the default version in action.yaml
gets updated before pushing the release tag so that the default version
matches the action version. Right now the default version is always one
version behind, which is mildly inconvenient.

Sorry for all the whitespace changes, it should be a one time thing for
using yq to update action.yaml.

Signed-off-by: Michi Mutsuzaki <[email protected]>
  • Loading branch information
michi-covalent authored and joestringer committed Jan 30, 2024
1 parent ed24dee commit f84dbae
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 28 deletions.
12 changes: 0 additions & 12 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"gitAuthor": "renovate[bot] <[email protected]>",
"includePaths": [
".github/workflows/**",
"action.yaml",
"go.mod",
"go.sum",
"Dockerfile",
Expand Down Expand Up @@ -93,16 +92,5 @@
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)\\s+.+version: (?<currentValue>.*)"
]
},
{
"fileMatch": [
"^action\\.yaml$",
],
// This regex manages version strings in GitHub actions files,
// similar to the examples shown here:
// https://docs.renovatebot.com/modules/manager/regex/#advanced-capture
"matchStrings": [
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)\\s+.+default: '(?<currentValue>.*)'"
]
},
]
}
35 changes: 35 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# little-vm-helper Release Process

## Set `RELEASE` environment variable

Set `RELEASE` environment variable to the new version. For example:

export RELEASE=v0.0.16

## Open a pull request

Bump up the default version in action.yaml and open a pull request against `main` branch:

alias yq='docker run --rm -v "${PWD}":/workdir --user "$(id -u):$(id -g)" mikefarah/yq:4.40.5'
yq ".inputs.lvh-version.default = \"$RELEASE\"" -i action.yaml
git checkout -b pr/prepare-$RELEASE
git add action.yaml
git commit -s -m "Prepare for $RELEASE release"
git push origin HEAD

Wait for the PR to be reviewed and merged.

## Tag a release

Checkout `main` branch:

git checkout main
git pull origin main

Set the commit you want to tag. Usually this is the most recent commit on `main`, i.e.

export COMMIT_SHA=$(git rev-parse origin/main)

Then tag and push the release:

git tag -a $RELEASE -m "$RELEASE release" $COMMIT_SHA && git push origin $RELEASE
21 changes: 5 additions & 16 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ inputs:
lvh-version:
description: 'LVH cli version (Docker tag)'
required: true
# renovate: datasource=github-tags depName=cilium/little-vm-helper
default: 'v0.0.14'
default: 'v0.0.16'
cmd:
description: 'Commands to run in a VM (any occurance of "$" within "cmd" must be escaped)'
required: true
Expand Down Expand Up @@ -95,7 +94,6 @@ runs:
dependencies_sha=$(echo ${dependencies} | md5sum)
echo "dependency_list_sha=${dependencies_sha}" >> $GITHUB_OUTPUT
- name: Install LVH cli
if: ${{ inputs.provision == 'true' && steps.find-lvh-cli.outputs.skip != 'true' }}
shell: bash
Expand All @@ -105,15 +103,13 @@ runs:
docker rm $cid
chmod +x /tmp/lvh
sudo mv /tmp/lvh /bin/lvh
- name: Load install packages from GitHub cache
if: ${{ inputs.provision == 'true' && inputs.install-dependencies == 'true' }}
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
id: package-cache
with:
path: /tmp/.ubuntu-pkgs
key: ${{ runner.os }}-${{ steps.find-lvh-cli.outputs.runner_os_id }}-pkgs-cilium-little-vm-helper-${{ steps.find-lvh-cli.outputs.dependency_list_sha }}

- name: Download LVH dependencies
if: ${{ inputs.provision == 'true' && inputs.install-dependencies == 'true' && steps.package-cache.outputs.cache-hit != 'true' }}
shell: bash
Expand All @@ -131,7 +127,6 @@ runs:
[ $success -eq 1 ] || exit 42
sudo mkdir -p /tmp/.ubuntu-pkgs
sudo cp /var/cache/apt/archives/*.deb /tmp/.ubuntu-pkgs
- name: Install dependencies
if: ${{ inputs.provision == 'true' && inputs.install-dependencies == 'true' }}
shell: bash
Expand All @@ -141,27 +136,23 @@ runs:
sudo cp /tmp/.ubuntu-pkgs/*.deb /var/cache/apt/archives/
sudo apt-get -y --no-install-recommends install /tmp/.ubuntu-pkgs/*.deb
sudo kvm-ok
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
if: ${{ inputs.provision == 'true' }}
id: cache-lvh-image
with:
path: /images/${{ inputs.image }}_${{ inputs.image-version }}.qcow2.zst
key: lvh-image-${{ inputs.image }}_${{ inputs.image-version }}

- name: Derive VM image file name
if: ${{ inputs.provision == 'true' }}
id: derive-image-name
shell: bash
run: echo "image-name=$(echo ${{ inputs.image }} | sed 's/\-ci//g')_$(echo ${{ inputs.image-version }} | sed 's/\(.*\)\-\(.*\)/\1/g')" >> $GITHUB_OUTPUT

- name: Fetch VM image
if: ${{ inputs.provision == 'true' && steps.cache-lvh-image.outputs.cache-hit != 'true' }}
shell: bash
run: |
sudo mkdir /images; sudo chmod 777 /images
/bin/lvh images pull --cache quay.io/lvh-images/${{ inputs.image }}:${{ inputs.image-version }} --dir "/"
- name: Start VM
if: ${{ inputs.provision == 'true' }}
shell: bash
Expand All @@ -182,7 +173,6 @@ runs:
--cpu=${{ inputs.cpu }} --mem=${{ inputs.mem }} --cpu-kind ${{ inputs.cpu-kind }} \
--console-log-file /tmp/console.log \
${extraArgs[@]}
- name: Wait for VM's SSH Server
if: ${{ inputs.provision == 'true' }}
shell: bash
Expand Down Expand Up @@ -219,12 +209,11 @@ runs:
cat /tmp/console.log
exit 42
fi
- name: Run test cmd in VM
shell: bash
run: |
ssh -p ${{ inputs.ssh-port }} -o "StrictHostKeyChecking=no" root@localhost << EOF
set -eu
ssh -p ${{ inputs.ssh-port }} -o "StrictHostKeyChecking=no" root@localhost << EOF
set -eu
${{ inputs.cmd }}
EOF
${{ inputs.cmd }}
EOF

0 comments on commit f84dbae

Please sign in to comment.