feat(ci): beta-release flow
This commit is contained in:
parent
6def5a1168
commit
94b5098cc1
5 changed files with 188 additions and 92 deletions
4
.github/workflows/alpha-release.yml
vendored
4
.github/workflows/alpha-release.yml
vendored
|
@ -115,10 +115,6 @@ jobs:
|
|||
name: cli
|
||||
path: cli
|
||||
|
||||
- name: Display structure of downloaded files
|
||||
run: ls -R
|
||||
working-directory: cli
|
||||
|
||||
- name: Create alpha release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
|
|
154
.github/workflows/beta-release.yml
vendored
Normal file
154
.github/workflows/beta-release.yml
vendored
Normal file
|
@ -0,0 +1,154 @@
|
|||
name: Beta Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Beta version tag (1, 2, 3, ...)'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
create-tag:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
tagname: ${{ steps.create_tag.outputs.tagname }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Create Tag
|
||||
id: create_tag
|
||||
uses: butlerlogic/action-autotag@stable
|
||||
env:
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||
with:
|
||||
tag_prefix: 'v'
|
||||
tag_suffix: '-beta.${{ github.event.inputs.tag }}'
|
||||
|
||||
build-images:
|
||||
runs-on: ubuntu-latest
|
||||
needs: create-tag
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push images
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: meienberger/runtipi:${{ needs.create-tag.outputs.tagname }}
|
||||
cache-from: type=registry,ref=meienberger/runtipi:buildcache
|
||||
cache-to: type=registry,ref=meienberger/runtipi:buildcache,mode=max
|
||||
|
||||
build-cli:
|
||||
runs-on: ubuntu-latest
|
||||
needs: create-tag
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- uses: pnpm/action-setup@v2.2.4
|
||||
name: Install pnpm
|
||||
id: pnpm-install
|
||||
with:
|
||||
version: 8
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
id: pnpm-cache
|
||||
run: |
|
||||
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Set version
|
||||
run: pnpm -r --filter cli set-version ${{ needs.create-tag.outputs.tagname }}
|
||||
|
||||
- name: Build CLI
|
||||
run: pnpm -r --filter cli package
|
||||
|
||||
- name: Upload CLI
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: cli
|
||||
path: packages/cli/dist
|
||||
|
||||
publish-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [create-tag, build-images, build-cli]
|
||||
|
||||
steps:
|
||||
- name: Download CLI
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: cli
|
||||
path: cli
|
||||
|
||||
- name: Create beta release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ needs.create-tag.outputs.tagname }}
|
||||
release_name: ${{ needs.create-tag.outputs.tagname }}
|
||||
draft: false
|
||||
prerelease: true
|
||||
|
||||
- name: Upload X64 Linux CLI binary to release
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: cli/bin/cli-x64
|
||||
asset_name: runtipi-cli-linux-x64
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
- name: Upload ARM64 Linux CLI binary to release
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: cli/bin/cli-arm64
|
||||
asset_name: runtipi-cli-linux-arm64
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
e2e-tests:
|
||||
needs: [create-tag, build-images, build-cli, publish-release]
|
||||
uses: './.github/workflows/e2e.yml'
|
||||
secrets: inherit
|
||||
with:
|
||||
tag: ${{ needs.create-tag.outputs.tagname }}
|
94
.github/workflows/e2e.yml
vendored
94
.github/workflows/e2e.yml
vendored
|
@ -1,42 +1,18 @@
|
|||
name: E2E Tests
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- release/*
|
||||
workflow_call:
|
||||
inputs:
|
||||
tag:
|
||||
type: string
|
||||
description: 'Version to test (e.g. v1.6.0-beta.1)'
|
||||
workflow_run:
|
||||
inputs:
|
||||
tag:
|
||||
type: string
|
||||
description: 'Version to test (e.g. v1.6.0-beta.1)'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push images
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: meienberger/runtipi:e2e
|
||||
cache-from: type=registry,ref=meienberger/runtipi:buildcache-e2e
|
||||
cache-to: type=registry,ref=meienberger/runtipi:buildcache-e2e,mode=max
|
||||
|
||||
deploy:
|
||||
timeout-minutes: 15
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -93,23 +69,15 @@ jobs:
|
|||
- name: Wait 1 minute for Droplet to be ready
|
||||
run: sleep 60
|
||||
|
||||
- name: Extract branch name from ref
|
||||
id: extract-branch-name
|
||||
run: |
|
||||
branch_name=$(echo ${{ github.ref }} | sed 's/refs\/heads\///')
|
||||
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Deploy app to Droplet
|
||||
uses: fifsky/ssh-action@master
|
||||
with:
|
||||
command: |
|
||||
echo 'Cloning repo on branch ${{ github.head_ref }}'
|
||||
git clone --single-branch --branch ${{ steps.extract-branch-name.outputs.branch_name }} https://github.com/${{ github.repository }}
|
||||
echo 'Waiting for dpkg lock to be released'
|
||||
cd runtipi
|
||||
echo 'Checking out branch ${{ steps.extract-branch-name.outputs.branch_name }}'
|
||||
git checkout ${{ steps.extract-branch-name.outputs.branch_name }}
|
||||
sudo ./scripts/start-e2e.sh e2e
|
||||
echo 'Downloading install script from GitHub'
|
||||
curl -s https://raw.githubusercontent.com/meienberger/runtipi/${{ github.event.inputs.tag }}/scripts/install.sh > install.sh
|
||||
chmod +x install.sh
|
||||
echo 'Running install script'
|
||||
./install.sh --version ${{ github.event.inputs.tag }}
|
||||
echo 'App deployed'
|
||||
host: ${{ steps.get-droplet-ip.outputs.droplet_ip }}
|
||||
user: root
|
||||
|
@ -171,8 +139,6 @@ jobs:
|
|||
permissions:
|
||||
pages: write # to deploy to Pages
|
||||
id-token: write # to verify the deployment originates from an appropriate source
|
||||
pull-requests: write # to comment on the PR
|
||||
issues: write # to comment on the PR
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
|
@ -193,37 +159,9 @@ jobs:
|
|||
path: playwright-report/
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
id: report-deployment
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v2
|
||||
|
||||
- name: Comment on PR
|
||||
uses: actions/github-script@v6
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const comments = await github.rest.issues.listComments({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo
|
||||
});
|
||||
|
||||
const comment = comments.data.find(comment => comment.body.includes('Playwright report:'));
|
||||
|
||||
if (comment) {
|
||||
await github.rest.issues.deleteComment({
|
||||
comment_id: comment.id,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo
|
||||
});
|
||||
}
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `Playwright report: ${{ steps.report-deployment.outputs.page_url }}`
|
||||
})
|
||||
|
||||
teardown:
|
||||
runs-on: ubuntu-latest
|
||||
if: always()
|
||||
|
|
3
.github/workflows/release-candidate.yml
vendored
3
.github/workflows/release-candidate.yml
vendored
|
@ -2,9 +2,6 @@ name: Release candidate
|
|||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- release/*
|
||||
|
||||
jobs:
|
||||
# Build images and publish RCs to DockerHub
|
||||
|
|
|
@ -16,9 +16,17 @@ fi
|
|||
### CLI arguments
|
||||
### --------------------------------
|
||||
UPDATE="false"
|
||||
VERSION="latest"
|
||||
while [ -n "${1-}" ]; do
|
||||
case "$1" in
|
||||
--update) UPDATE="true" ;;
|
||||
--version)
|
||||
shift # Move to the next parameter
|
||||
VERSION="$1" # Assign the value to VERSION
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Option --version requires a value" && exit 1
|
||||
fi
|
||||
;;
|
||||
--)
|
||||
shift # The double dash makes them parameters
|
||||
break
|
||||
|
@ -161,15 +169,18 @@ function check_dependency_and_install() {
|
|||
# Example
|
||||
# check_dependency_and_install "openssl"
|
||||
|
||||
|
||||
LATEST_VERSION=$(curl -s https://api.github.com/repos/meienberger/runtipi/releases/latest | grep tag_name | cut -d '"' -f4)
|
||||
|
||||
LATEST_ASSET="runtipi-cli-linux-x64"
|
||||
if [ "$ARCHITECTURE" == "arm64" ] || [ "$ARCHITECTURE" == "aarch64" ]; then
|
||||
LATEST_ASSET="runtipi-cli-linux-arm64"
|
||||
# If version was not given it will install the latest version
|
||||
if [[ "${VERSION}" == "latest" ]]; then
|
||||
LATEST_VERSION=$(curl -s https://api.github.com/repos/meienberger/runtipi/releases/latest | grep tag_name | cut -d '"' -f4)
|
||||
VERSION="${LATEST_VERSION}"
|
||||
fi
|
||||
|
||||
URL="https://github.com/meienberger/runtipi/releases/download/$LATEST_VERSION/$LATEST_ASSET"
|
||||
ASSET="runtipi-cli-linux-x64"
|
||||
if [ "$ARCHITECTURE" == "arm64" ] || [ "$ARCHITECTURE" == "aarch64" ]; then
|
||||
ASSET="runtipi-cli-linux-arm64"
|
||||
fi
|
||||
|
||||
URL="https://github.com/meienberger/runtipi/releases/download/$VERSION/$ASSET"
|
||||
|
||||
if [[ "${UPDATE}" == "false" ]]; then
|
||||
mkdir -p runtipi
|
||||
|
|
Loading…
Reference in a new issue