build: Add workflow for creating draft releases (#1402)

* build: Change pump-version script to use flags

* build: Create initial prepare-release workflow

* build: Fix release script path

* build: Rename .env.example to example.env

* docs: propagate example.env rename

* build: Fix pump-version script patch argument

* build: Final tweaks to release scripts
This commit is contained in:
bo0tzz 2023-01-24 16:26:58 +01:00 committed by GitHub
parent a6f7fdba4e
commit 50c36068e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 99 additions and 18 deletions

49
.github/workflows/prepare-release.yml vendored Normal file
View file

@ -0,0 +1,49 @@
name: Prepare new release
on:
workflow_dispatch:
inputs:
serverBump:
description: 'Bump server version'
required: true
default: 'false'
type: choice
options:
- false
- minor
- patch
mobileBump:
description: 'Bump mobile build number'
required: false
type: boolean
jobs:
tag_release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Bump version
run: misc/release/pump-version.sh -s "${{ inputs.serverBump }}" -m "${{ inputs.mobileBump }}"
- name: Commit and tag
uses: EndBug/add-and-commit@v9
with:
author_name: Immich Release Bot
author_email: bot@immich.app
message: "Version ${{ env.IMMICH_VERSION }}"
tag: ${{ env.IMMICH_VERSION }}
push: true
- name: Create draft release
uses: softprops/action-gh-release@v1
with:
draft: true
tag_name: ${{ env.IMMICH_VERSION }}
generate_release_notes: true
body_path: misc/release/notes.tmpl
files: |
docker/docker-compose.yml
docker/example.env

View file

@ -23,7 +23,7 @@ All the services are packaged to run as with single Docker Compose command.
### Instructions
1. Clone the project repo.
2. Run `cp docker/.env.example docker/.env`.
2. Run `cp docker/example.env docker/.env`.
3. Edit `docker/.env` to provide values for the required variables `UPLOAD_LOCATION` and `JWT_SECRET`.
4. From the root directory, run:

View file

@ -8,7 +8,7 @@ Docker Compose is the recommended method to run Immich in production. Below are
### Step 1 - Download the required files
Download [`docker-compose.yml`][compose-file] [`.env.example`][env-file].
Download [`docker-compose.yml`][compose-file] [`example.env`][env-file].
From a directory of your choice (e.g. `./immich-app`) run the following commands:
@ -17,7 +17,7 @@ wget https://raw.githubusercontent.com/immich-app/immich/main/docker/docker-comp
```
```bash title="Get .env file"
wget -O .env https://raw.githubusercontent.com/immich-app/immich/main/docker/.env.example
wget -O .env https://raw.githubusercontent.com/immich-app/immich/main/docker/example.env
```
### Step 2 - Populate the .env file with custom values
@ -131,5 +131,5 @@ Immich is currently under heavy development, which means you can expect breaking
:::
[compose-file]: https://raw.githubusercontent.com/immich-app/immich/main/docker/docker-compose.yml
[env-file]: https://raw.githubusercontent.com/immich-app/immich/main/docker/.env.example
[env-file]: https://raw.githubusercontent.com/immich-app/immich/main/docker/example.env
[watchtower]: https://containrrr.dev/watchtower/

View file

@ -28,7 +28,7 @@ Install Immich using Portainer's Stack feature.
alt="Dot Env Example"
/>
9. Copy the content of the `.env.example` file from the [GitHub repository](https://raw.githubusercontent.com/immich-app/immich/main/docker/.env.example) and paste into the editor.
9. Copy the content of the `example.env` file from the [GitHub repository](https://raw.githubusercontent.com/immich-app/immich/main/docker/example.env) and paste into the editor.
10. Switch back to "**Simple Mode**".
<img

View file

@ -16,7 +16,7 @@ curl -o- https://raw.githubusercontent.com/immich-app/immich/main/install.sh | b
The script will perform the following actions:
1. Download [docker-compose.yml](https://github.com/immich-app/immich/blob/main/docker/docker-compose.yml), and the [.env](https://github.com/immich-app/immich/blob/main/docker/.env.example) file from the main branch of the [repository](https://github.com/immich-app/immich).
1. Download [docker-compose.yml](https://github.com/immich-app/immich/blob/main/docker/docker-compose.yml), and the [.env](https://github.com/immich-app/immich/blob/main/docker/example.env) file from the main branch of the [repository](https://github.com/immich-app/immich).
2. Populate the `.env` file with necessary information based on the current directory path.
3. Start the containers.

View file

@ -53,7 +53,7 @@ alt="Select Plugins > Compose.Manager > Add New Stack > Label it Immich"
</details>
5. Click "**Save Changes**", you will be promoted to edit stack UI labels, just leave this blank and click "**Ok**"
6. Select the cog ⚙️ next to Immich, click "**Edit Stack**", then click "**Env File**"
7. Past the entire contents of the [Immich .env.example](https://raw.githubusercontent.com/immich-app/immich/main/docker/.env.example) file into the Unraid editor, then **before saving** edit the following:
7. Past the entire contents of the [Immich example.env](https://raw.githubusercontent.com/immich-app/immich/main/docker/example.env) file into the Unraid editor, then **before saving** edit the following:
- `JWT_SECRET`: Generate a unique secret and paste the value here > Can be generated by either typing `openssl rand -base64 128` in your terminal or copying from [uuidgenerator](https://www.uuidgenerator.net/version1)
- `UPLOAD_LOCATION`: Create a folder in your Images Unraid share and place the **absolute** location here > For example my _"images"_ share has a folder within it called _"immich"_. If I browse to this directory in the terminal and type `pwd` the output is `/mnt/user/images/immich`. This is the exact value I need to enter as my `UPLOAD_LOCATION`

View file

@ -28,7 +28,7 @@ download_docker_compose_file() {
download_dot_env_file() {
echo "Downloading .env file..."
curl -L https://raw.githubusercontent.com/immich-app/immich/$release_version/docker/.env.example -o ./.env >/dev/null 2>&1
curl -L https://raw.githubusercontent.com/immich-app/immich/$release_version/docker/example.env -o ./.env >/dev/null 2>&1
}
replace_env_value() {

21
misc/release/notes.tmpl Normal file
View file

@ -0,0 +1,21 @@
## Highlights
{{RELEASE HIGHLIGHTS}}
As always, please consider supporting the project.
🎉 Cheer! 🎉
## Support
<p align="center">
<img src="https://media.giphy.com/media/LStqgGESXW8XnuCv5y/giphy.gif" width="250" title="Loading ~4000 images/videos">
</p>
If you find the project helpful and it helps you in some ways, you can support the project [one time](https://github.com/sponsors/alextran1502?frequency=one-time&sponsor=alextran1502) or [monthly](https://github.com/sponsors/alextran1502) from GitHub Sponsors
It is a great way to let me know that you want me to continue developing and working on this project for years to come.
## What's Changed

View file

@ -3,16 +3,25 @@
#
# Pump one or both of the server/mobile versions in appropriate files
#
# usage: './scripts/pump-version.sh <major|minor|patch|fase> <mobile|false'>
# usage: './scripts/pump-version.sh -s <major|minor|patch> <-m>
#
# examples:
# ./scripts/pump-version.sh major false # 1.0.0+50 => 2.0.0+50
# ./scripts/pump-version.sh minor mobile # 1.0.0+50 => 1.1.0+51
# ./scripts/pump-version.sh false mobile # 1.0.0+50 => 1.0.0+51
# ./scripts/pump-version.sh -s major # 1.0.0+50 => 2.0.0+50
# ./scripts/pump-version.sh -s minor -m # 1.0.0+50 => 1.1.0+51
# ./scripts/pump-version.sh -m # 1.0.0+50 => 1.0.0+51
#
SERVER_PUMP=$1
MOBILE_PUMP=$2
SERVER_PUMP="false"
MOBILE_PUMP="false"
while getopts 's:m:' flag; do
case "${flag}" in
s) SERVER_PUMP=${OPTARG} ;;
m) MOBILE_PUMP=${OPTARG} ;;
*) echo "Invalid args"
exit 1 ;;
esac
done
CURRENT_SERVER=$(cat server/package.json | jq -r '.version')
MAJOR=$(echo $CURRENT_SERVER | cut -d '.' -f1)
@ -23,12 +32,12 @@ if [[ $SERVER_PUMP == "major" ]]; then
MAJOR=$((MAJOR + 1))
elif [[ $SERVER_PUMP == "minor" ]]; then
MINOR=$((MINOR + 1))
elif [[ $1 == "patch" ]]; then
elif [[ $SERVER_PUMP == "patch" ]]; then
PATCH=$((PATCH + 1))
elif [[ $SERVER_PUMP == "false" ]]; then
echo 'Skipping Server Pump'
else
echo 'Expected <major|minor|patch|false> for the first argument'
echo 'Expected <major|minor|patch|false> for the server argument'
exit 1
fi
@ -36,12 +45,12 @@ NEXT_SERVER=$MAJOR.$MINOR.$PATCH
CURRENT_MOBILE=$(cat mobile/pubspec.yaml | grep "^version: .*+[0-9]\+$" | cut -d "+" -f2)
NEXT_MOBILE=$CURRENT_MOBILE
if [[ $MOBILE_PUMP == "mobile" ]]; then
if [[ $MOBILE_PUMP == "true" ]]; then
set $((NEXT_MOBILE++))
elif [[ $MOBILE_PUMP == "false" ]]; then
echo 'Skipping Mobile Pump'
else
echo 'Expected <mobile|false> for the second argument'
echo "Fatal: MOBILE_PUMP value $MOBILE_PUMP is invalid"
exit 1
fi
@ -65,3 +74,5 @@ if [ "$CURRENT_MOBILE" != "$NEXT_MOBILE" ]; then
sed -i "s/\"android\.injected\.version\.code\" => $CURRENT_MOBILE,/\"android\.injected\.version\.code\" => $NEXT_MOBILE,/" mobile/android/fastlane/Fastfile
sed -i "s/^version: $CURRENT_SERVER+$CURRENT_MOBILE$/version: $NEXT_SERVER+$NEXT_MOBILE/" mobile/pubspec.yaml
fi
echo "IMMICH_VERSION=v$NEXT_SERVER" >> $GITHUB_ENV