Skip to content

Commit 4696afa

Browse files
authored
ci(setup-scalingo): add automation for releases (#2)
1 parent 0677976 commit 4696afa

File tree

5 files changed

+128
-103
lines changed

5 files changed

+128
-103
lines changed

.github/workflows/release-please.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
10+
name: release-please-setup-scalingo
11+
12+
env:
13+
ACTION_NAME: release-please-action
14+
15+
jobs:
16+
release-please:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: google-github-actions/release-please-action@v3
20+
with:
21+
release-type: simple
22+
package-name: ${{ env.ACTION_NAME }}
23+
command: github-release
24+
- uses: actions/checkout@v2
25+
if: ${{ steps.release.outputs.release_created }}
26+
- name: tag major and minor versions
27+
if: ${{ steps.release.outputs.release_created }}
28+
run: |
29+
git config user.name github-actions[bot]
30+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
31+
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/scalingo-community/setup-scalingo.git"
32+
git tag -d v${{ steps.release.outputs.major }} || true
33+
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
34+
git push origin :v${{ steps.release.outputs.major }} || true
35+
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
36+
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}"
37+
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
38+
git push origin v${{ steps.release.outputs.major }}
39+
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}

.github/workflows/test-setup.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ jobs:
1313
test-latest-version:
1414
strategy:
1515
matrix:
16-
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-latest, macos-11, macos-12, macos-latest]
16+
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-latest, macos-11, macos-12]
1717
runs-on: ${{ matrix.os }}
1818

1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v3
2222
- name: Setup scalingo CLI
23-
uses: ./setup-scalingo
23+
uses: ./
2424
with:
2525
region: 'osc-fr1'
2626
- name: Check version
@@ -39,14 +39,14 @@ jobs:
3939
test-specific-version:
4040
strategy:
4141
matrix:
42-
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-latest, macos-11, macos-12, macos-latest]
42+
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-latest, macos-11, macos-12]
4343
runs-on: ${{ matrix.os }}
4444

4545
steps:
4646
- name: Checkout
4747
uses: actions/checkout@v3
4848
- name: Setup scalingo CLI
49-
uses: ./setup-scalingo
49+
uses: ./
5050
with:
5151
version: 1.28.1
5252
region: 'osc-fr1'
@@ -64,14 +64,14 @@ jobs:
6464
if: ${{ github.repository == 'scalingo-community/scalingo-actions' }}
6565
strategy:
6666
matrix:
67-
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-latest, macos-11, macos-12, macos-latest]
67+
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-latest, macos-11, macos-12]
6868
runs-on: ${{ matrix.os }}
6969

7070
steps:
7171
- name: Checkout
7272
uses: actions/checkout@v3
7373
- name: Setup scalingo CLI
74-
uses: ./setup-scalingo
74+
uses: ./
7575
with:
7676
region: 'osc-fr1'
7777
api_token: ${{ secrets.SCALINGO_API_TOKEN }}

README.md

Lines changed: 83 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,86 @@
1-
## Github Actions for Scalingo
1+
# scalingo-community/setup-scalingo
22

3-
## Community-powered
4-
These actions are a community initiative of users and are in no way related to or supported by Scalingo.
5-
Your feedbacks and contributions are welcome to correct or improve them.
3+
The `scalingo-community/setup-scalingo` action is a composite action that sets up Scalingo CLI in your GitHub Actions workflow by:
64

7-
## Contributions are welcome
5+
- Downloading the latest or a specific version of Scalingo CLI and adding it to the PATH.
6+
- Configuring the Scalingo CLI configuration file with your region, app name and Scalingo API token.
7+
8+
After you've used the action, subsequent steps in the same job can run arbitrary Scalingo commands using the GitHub Actions `run:` syntax. This allows most Scalingo commands to work exactly like they do on your local command line
9+
10+
## Usage
11+
12+
This action can be run on `ubuntu-latest` and `macos-latest` GitHub Actions runners. Note that the `region` input is always required.
13+
14+
The default configuration installs the latest version of Scalingo CLI:
15+
```
16+
steps:
17+
- uses: scalingo-community/setup-scalingo@v1
18+
with:
19+
region: 'osc-fr1'
20+
```
21+
22+
Subsequent steps can launch command with the configured and authenticated CLI (you can create API Token [in the Scalingo dashboard](https://dashboard.scalingo.com/account/tokens)):
23+
```
24+
steps:
25+
- uses: scalingo-community/setup-scalingo@v1
26+
with:
27+
region: 'osc-fr1'
28+
api_token: '${{ secrets.scalingo_api_token }}
29+
app_name: 'my_app'
30+
31+
- run: scalingo restart # will restart all the processes of the app "my_app" in region "osc-fr1"
32+
```
33+
34+
35+
36+
## Inputs
37+
The action requires the following inputs:
38+
39+
- `region` - The region of your app.
40+
41+
The action also accepts the following optional inputs:
42+
43+
- `api_token` - The Scalingo API token to use. If not provided, the subsequent steps will try to use the `SCALINGO_API_TOKEN` environment variable.
44+
- `version` - The version of Scalingo CLI to install. If not provided, the action will install the latest version.
45+
- `app_name` - The name of the app to use. If not provided, the subsequent steps will try to use the `SCALINGO_APP` environment variable.
46+
- `git_remote` - Choose the name of Git remote to allow git operations (requires the `region` and `app_name` inputs). The default value is `scalingo`.
47+
48+
49+
For testing or debugging purpose, the following inputs can also be used:
50+
51+
- `scalingo_api_url` - The Scalingo API URL to use. If not provided, the action will use the default API URL for the given region.
52+
- `scalingo_auth_url` - The Scalingo Auth URL to use. If not provided, the action will use the default Auth URL for the given region.
53+
- `unsecure_ssl` - Disable SSL verification with APIs.
54+
- `scalingo_db_url` - The Scalingo DB URL to use. If not provided, the action will use the default DB URL for the given region.
55+
- `scalingo_ssh_host` - The Scalingo SSH Host to use. If not provided, the action will use the default SSH Host for the given region.
56+
57+
## Features
58+
59+
### Git remote auto-configuration
60+
61+
If the code you provide the `region` and `app_name` inputs, the action will automatically configure a Git remote named `scalingo` to allow git operations on your app. This is useful if you want to run `git push scalingo master` in your workflow.
62+
63+
```
64+
steps:
65+
- name: Checkout code
66+
uses: actions/checkout@v3
67+
- Configure Scalingo CLI
68+
uses: scalingo-community/setup-scalingo@v1
69+
with:
70+
region: 'osc-fr1'
71+
app_name: 'my_app'
72+
- name: Deploy to Scalingo with Git
73+
run: git push scalingo main
74+
```
75+
76+
### Custom version of Scalingo CLI
77+
78+
You can install a specific version of Scalingo CLI:
79+
```
80+
steps:
81+
- uses: scalingo-community/setup-scalingo@v1
82+
with:
83+
region: 'osc-fr1'
84+
version: 1.28.2
85+
```
886

9-
_especially for the following topics_:
10-
- rewriting the full setup-scalingo action in TS (instead of a composite "shell" Action, inspired from [hashicorp/setup-terraform](https://github.com/hashicorp/setup-terraform)), this will enable automatic caching thanks to `@actions/tool-cache`
11-
- full-compatibility with Windows runners
12-
- action to run commands in one-off containers
13-
- action to create database backup
14-
- action to create review app (with optional database copy !)
File renamed without changes.

setup-scalingo/README.md

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)