Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change: use GitHub composite actions over NPM-based for deployments* actions #32

Merged
merged 1 commit into from Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/test-deployments-create.yml
@@ -0,0 +1,27 @@
name: Deployments Create

on:
push:
branches:
- main
# Sadly, we cannot test this on a Pull Request. At least validate it after merge.

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Deployments Create
id: publish
uses: ./deployments-create
with:
ref: ${{ github.sha }}
environment: test
version: ${{ github.sha }}
date: 2021-01-01
docker-tag: ${{ github.sha }}
github-token: ${{ secrets.DEPLOYMENT_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/test-deployments-update.yml
@@ -0,0 +1,27 @@
name: Deployments Update

on:
deployment:

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Test in progress
uses: ./deployments-update
with:
github-token: ${{ secrets.DEPLOYMENT_TOKEN }}
state: in_progress
description: "Deployment of ${{ github.event.deployment.payload.version }} to ${{ github.event.deployment.environment }} started"

- name: Test successful
uses: ./deployments-update
with:
github-token: ${{ secrets.DEPLOYMENT_TOKEN }}
state: success
description: "Successfully deployed ${{ github.event.deployment.payload.version }} on ${{ github.event.deployment.environment }}"
28 changes: 26 additions & 2 deletions deployments-create/action.yml
Expand Up @@ -20,6 +20,30 @@ inputs:
github-token:
description: 'GitHub Token; cannot be the GITHUB_TOKEN, as that token cannot trigger another workflow'
required: true

runs:
using: 'node12'
main: 'dist/index.js'
using: 'composite'
steps:
- shell: bash
run: |
echo '{
"ref": "${{ inputs.ref }}",
"environment": "${{ inputs.environment }}",
"description": "${{ inputs.version }} on ${{ inputs.date }}",
"auto_merge": false,
"required_contexts": [],
"payload": {
"tag": "${{ inputs.docker-tag }}",
"version": "${{ inputs.version }}",
"date": "${{ inputs.date }}"
}
}' > payload.json

curl --fail \
-X POST \
-H "Authorization: token ${{ inputs.github-token }}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Accept: application/vnd.github.ant-man-preview+json" \
-H "Accept: application/vnd.github.flash-preview+json" \
https://api.github.com/repos/${{ github.repository }}/deployments \
-d @payload.json