Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e97c105
change master to main
bobheadxi Feb 21, 2022
24c295a
bobheadxi/deployments@v1 (#40)
bobheadxi Feb 22, 2022
cbac5c8
fix cleanup workflow
bobheadxi Feb 22, 2022
1592370
add back auto_inactive as an alternative behaviour
bobheadxi Feb 22, 2022
a835a79
fix migration guide
bobheadxi Feb 22, 2022
1d148a8
only run pipeline on branch pushes
bobheadxi Feb 22, 2022
622c06a
fix saleor example link
bobheadxi Feb 22, 2022
86fa294
add link to show and tell discussion
bobheadxi Feb 22, 2022
b0db961
start: add 'payload' parameter (#87)
bobheadxi Feb 28, 2022
a9488c4
Make delete-env work as documented (#101)
awesomeunleashed May 10, 2022
11bd644
default to the ${{ github.token }} (#102)
mxcl May 10, 2022
b4a49fb
doc: add call for maintainers
bobheadxi May 10, 2022
cc8bbd0
ci: run tests on PRs too (#109)
paullarsen-unlikely Jun 11, 2022
9d4477f
[BUGFIX] Don't deactivate already inactive deployments (#104)
paullarsen-unlikely Jun 22, 2022
6d3b6bd
deps: bump actions/core (#124)
johncarter-phntm Jan 19, 2023
102a9c1
fix: delete env from settings (#134)
devthejo Jan 20, 2023
88ce560
deps: upgrade deps and rebuild
bobheadxi Jan 20, 2023
30ebc9a
Document that `token` now has a default. (#1)
buckett Jan 24, 2023
5626e5f
Merge pull request #136 from buckett/token-readme
buckett Feb 25, 2023
b206567
doc: correct auto_inactive default value (#142)
theodorton May 23, 2023
9bf3b18
Allow finish step to update environment name (#146)
krainboltgreene May 23, 2023
b00ab86
Revert "Allow finish step to update environment name (#146)" (#148)
bobheadxi May 23, 2023
8a87bc3
feat: add `task` input (#141)
EndBug May 23, 2023
147cddb
doc: clarify token permissions (#166)
ai Mar 26, 2024
f463011
feat: Bump runtime to Node 20 (#163)
nschonni Mar 26, 2024
648679e
fix(delete-env): proper warning on 404 (#159)
mtfurlan Mar 26, 2024
d3f8ab5
fix: only set environment_url when success status and URL provided
AmSach May 4, 2026
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
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dist/* linguist-generated
dist/* linguist-generated -diff
48 changes: 48 additions & 0 deletions .github/workflows/cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: cleanup

on:
pull_request:
types: [ closed ]

jobs:
delete-env:
runs-on: ubuntu-latest
strategy:
matrix:
scenario: [ 'success', 'failure' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'

# Dependencies
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm install
- run: npm run build

- name: extract branch name
id: get_branch
shell: bash
env:
PR_HEAD: ${{ github.head_ref }}
run: echo "##[set-output name=branch;]$(echo ${PR_HEAD#refs/heads/} | tr / -)"

- name: delete environment
uses: ./
with:
step: delete-env
token: ${{ secrets.GITHUB_TOKEN }}
env: integration-test-${{ steps.get_branch.outputs.branch }}-${{ matrix.scenario }}
debug: true
144 changes: 139 additions & 5 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
name: pipeline

on: [push]
on:
push:
branches:
- '**'
pull_request: {}

jobs:
build:
checks:
runs-on: ubuntu-latest
steps:
# Environment
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '12'
node-version: '18'

# Dependencies
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action
Expand All @@ -30,3 +34,133 @@ jobs:
# Checks
- run: npm run prettier:check
- run: npm run build:check

integration-tests:
runs-on: ubuntu-latest
needs: checks
strategy:
matrix:
scenario: [ 'success', 'failure' ]
include:
- scenario: 'success'
exit_code: 0
- scenario: 'failure'
exit_code: 1
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'

# Dependencies
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm install
- run: npm run build

- name: extract branch name
id: get_branch
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/} | tr / -)"

- name: start deployment
uses: ./
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: integration-test-${{ steps.get_branch.outputs.branch }}-${{ matrix.scenario }}
desc: 'Deployment starting!'
debug: true

- name: parse repo name and owner
id: parse_repo
shell: bash
# outputs: owner, name
run: |
echo "owner=$(cut -d "/" -f 1 <<<"${{ github.repository }}")" >> $GITHUB_OUTPUT
echo "name=$(cut -d "/" -f 2 <<<"${{ github.repository }}")" >> $GITHUB_OUTPUT


- name: assert deployment in progress
uses: actions/github-script@v6
env:
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
status_id: ${{ steps.deployment.outputs.status_id }}
with:
script: |
const { deployment_id, status_id } = process.env;
if (!deployment_id) {
throw new Error("deployment_id not set");
}
if (!status_id) {
throw new Error("status_id not set");
}
const res = await github.rest.repos.getDeploymentStatus({
owner: "${{ steps.parse_repo.outputs.owner }}",
repo: "${{ steps.parse_repo.outputs.name }}",
deployment_id: parseInt(deployment_id, 10),
status_id: parseInt(status_id, 10),
});
console.log(res)
if (res.data.state !== "in_progress") {
throw new Error(`unexpected status ${res.data.state}`);
}

- name: set deployment status to ${{ matrix.scenario }}
uses: ./
id: finish
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ matrix.scenario }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env: ${{ steps.deployment.outputs.env }}
desc: 'Deployment complete'
debug: true

- name: assert deployment complete
uses: actions/github-script@v6
env:
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
status_id: ${{ steps.finish.outputs.status_id }}
expected_state: ${{ matrix.scenario }}
with:
script: |
const { deployment_id, status_id, expected_state } = process.env;
if (!deployment_id) {
throw new Error("deployment_id not set");
}
if (!status_id) {
throw new Error("status_id not set");
}
const res = await github.rest.repos.getDeploymentStatus({
owner: "${{ steps.parse_repo.outputs.owner }}",
repo: "${{ steps.parse_repo.outputs.name }}",
deployment_id: parseInt(deployment_id, 10),
status_id: parseInt(status_id, 10),
});
console.log(res)
if (res.data.state !== expected_state) {
throw new Error(`unexpected status ${res.data.state}`);
}

- name: mark environment as deactivated
uses: ./
with:
step: deactivate-env
token: ${{ secrets.GITHUB_TOKEN }}
env: ${{ steps.deployment.outputs.env }}
desc: Environment was pruned
debug: true
18 changes: 18 additions & 0 deletions .github/workflows/publish_v1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: publish@v1

on:
push:
tags: [ 'v1.*' ]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: update tag
run: |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
git tag -fa v1 -m "update v1 tag"
git push origin v1 --force
Loading