Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fb4d1f1
feat: support for envfile as secrets
carloscortonc Sep 28, 2024
bfd014e
feat: print logs after deploying
carloscortonc Sep 29, 2024
337110a
feat: create release-preview wf (#3)
carloscortonc Sep 1, 2025
1b70683
feat: switch to namespaces for config & deploy (#6)
carloscortonc Sep 2, 2025
399693d
feat: support docker compose (#8)
carloscortonc Sep 28, 2025
9f7e4a2
feat: upload command (#12)
carloscortonc Oct 4, 2025
de46b28
feat: simplify `deploy docker` definition (#14)
carloscortonc Oct 4, 2025
f9593b5
chore: update release-preview (#16)
carloscortonc Oct 4, 2025
db880ee
chore: update release-base node version
carloscortonc Oct 4, 2025
49ece4d
chore: add release-step summary
carloscortonc Oct 4, 2025
b34dd89
chore: force dry-run
carloscortonc Oct 4, 2025
87b9ce9
chore: fix dry-run command
carloscortonc Oct 4, 2025
cd3fdd6
chore(preview): update branches parameter
carloscortonc Oct 5, 2025
3edb850
chore(preview): update & debug
carloscortonc Oct 5, 2025
1601f14
chore(preview): unset GITHUB_EVENT_NAME
carloscortonc Oct 5, 2025
446f12b
chore(preview): override GITHUB_REF
carloscortonc Oct 5, 2025
4142793
chore(preview): debug
carloscortonc Oct 5, 2025
7ffd3b8
chore(preview): debug some more
carloscortonc Oct 5, 2025
d927470
chore: debug
carloscortonc Oct 5, 2025
06e7965
chore: override GITHUB_REF
carloscortonc Oct 5, 2025
b6cce6c
chore: debug
carloscortonc Oct 5, 2025
7867465
chore: patch semantic-release to log envCi
carloscortonc Oct 5, 2025
cd2eb75
chore: avoid unsetting GITHUB_ACTIONS so its recognized github-service
carloscortonc Oct 5, 2025
07d262d
chore: update github-token permissions
carloscortonc Oct 5, 2025
2999179
chore: include NPM token
carloscortonc Oct 5, 2025
03a60fc
chore: debug outputs
carloscortonc Oct 5, 2025
d50c6be
chore: patch export-data plugin to access notes
carloscortonc Oct 5, 2025
7233056
chore: fix output
carloscortonc Oct 5, 2025
90ff903
chore: switch to pr-comment
carloscortonc Oct 5, 2025
251544d
chore: fix setOutput in export-data plugin
carloscortonc Oct 5, 2025
9892dd4
chore: set correct output name
carloscortonc Oct 5, 2025
97d1bbd
chore: include reference to output delimiter
carloscortonc Oct 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/release-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: release-base
on:
workflow_call:
inputs:
dry_run:
required: true
type: boolean

jobs:
release-base:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build

- name: Release Preview
if: ${{ inputs.dry_run == true }}
id: release-preview
run: |
# Unset variables for semantic-release to believe we are not in a PR
# (https://github.com/semantic-release/env-ci/blob/master/services/github.js)
unset GITHUB_EVENT_NAME
unset GITHUB_EVENT_PATH
GITHUB_REF=$GITHUB_HEAD_REF
npx semantic-release --dry-run --no-ci --branches $GITHUB_REF --debug
env:
GITHUB_REF: ${{ github.head_ref }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Release summary
if: ${{ inputs.dry_run == true }}
uses: peter-evans/create-or-update-comment@v5
with:
issue-number: ${{ github.event.number }}
body: |
### 📦 Semantic Release Summary

- Version: **${{ steps.release-preview.outputs.new-release-version }}**
- Tag: **${{ steps.release-preview.outputs.new-release-git-tag }}**

---

${{ steps.release-preview.outputs.new-release-release-notes }}

- name: Semantic Release
if: ${{ inputs.dry_run == false }}
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: release-preview
on:
pull_request:
branches: [main]
types: [opened, synchronize]

jobs:
release-preview:
uses: ./.github/workflows/release-base.yml
with:
dry_run: true
secrets: inherit
27 changes: 7 additions & 20 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
name: release-publish
on:
push:
pull_request:
branches: [main]
types: [closed]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
if: github.event.pull_request.merged == true
uses: ./.github/workflows/release-base.yml
with:
dry_run: false
secrets: inherit
1 change: 1 addition & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
["@semantic-release/release-notes-generator", { "writerOpts": { "commitGroupsSort": ["feat", "fix"] } }],
"@semantic-release/changelog",
"@semantic-release/npm",
"semantic-release-export-data",
["@semantic-release/git", { "message": "chore(release): ${nextRelease.version}" }],
[
"@saithodev/semantic-release-backmerge",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ The process will:

- [**init**](/docs/commands.md#init): described above, to initially configure a server.
- [**deploy**](/docs/commands.md#deploy): deploy a docker/web application from a folder.
- [**upload**](/docs/commands.md#upload): upload files to the server.
- [**config**](/docs/commands.md#deploy): read and update configuration values.


## Development

```sh
Expand Down
81 changes: 71 additions & 10 deletions docs/commands.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,95 @@
List of available commands

# `init`
```
Perform initial configuration on a server
```sh
Usage: rpi init

Initialize server tools and configuration
```

# `deploy`
Deploy an application

## `deploy.dockerc`
```sh
Usage: rpi deploy dockerc [OPTIONS]

Deploy a docker-compose application

Options:
--files, -f List of docker-compose files (default: ["docker-compose.yaml"])
--exclude, -e List of paths to exclude from packaging e.g. "/dev" (default: ["/dev", "/etc"])
--dry-run Verify the list of entries that will be packaged, without performing deploy
--logs Show container logs after the indicated time (seconds). Use value <= 0 to skip (default: 5)
```

## `deploy.docker`
```sh
Usage: rpi deploy docker <location> [OPTIONS]

Deploy a docker application

Options:
--location Location of the folder containing the application
--name Name to tag the application. By default, the folder/file name will be used
--build-on-target Build docker image on target machine instead of local (default: true)
--logs Show container logs after the indicated time (seconds). Use value <= 0 to skip (default: 5)
```

Example:
```sh
rpi deploy ./dist --name=server -- -e PORT=8080 -p 8080:8080 --privileged --restart=unless-stopped
```
Usage: rpi deploy <location> [OPTIONS]

Deploy an application from a folder
> [!TIP]
> For more complex parameters, transition to a docker-compose.yaml file and simply use `rpi deploy`

## `deploy.web`
```sh
Usage: rpi deploy web <location> [OPTIONS]

Deploy a web application

Options:
--location Location of the folder containing the application
--type Type of application to deploy (allowed: "docker", "web", default: "docker")
--name Name to tag the application. By default, the folder/file name will be used
--build-on-target Build docker image on target machine instead of local (default: true)
--vars List of variables for docker applications in <KEY>=<VALUE> format, e.g. PORT=8080 (default: [])
--logs Show container logs after the indicated time (seconds). Use value <= 0 to skip (default: 5)
```

# `upload`

```sh
Usage: rpi upload <files...> [OPTIONS]

Upload files to the server

Options:
--files Location of the files to upload
-d, --dest Destination path on host (default: "~/registry/")
```

# `config`
Manage configuration

## `config.get`
```sh
Usage: rpi config get [key]

Read configuration values

Options:
--key Configuration key to read
```
Usage: rpi config <operation> [key] [value]

Read and update configuration values
## `config.set`
```sh
Usage: rpi config set <key> <value>

Update configuration values

Options:
--operation Operation to execute (default: "get")
--key Configuration key
--value For `set` operation, value to update
--key Configuration key to set
--value Configuration value to set
```
Loading
Loading