The SocialGouv GitHub Actions. Actions designed for repos with a .socialgouv
folder.
Workflow Action | usage |
---|---|
autodevops-build-register | Build and register docker images on ghcr.io |
autodevops-manifests | Generate kubernetes manifests |
autodevops-deploy | Deploy kubernetes manifests |
autodevops-create-db | Create a review branch database |
autodevops-release | Trigger semantic release run |
autodevops-deactivate | Cleanup environments and databases |
containers-cleaner | Organization container packages versions cleaner |
containers-list | List organization container packages versions |
Internal Action | usage |
---|---|
autodevops-env | Return kubernetes-friendly env variables |
harbor-build-register | Build and register docker images on internal harbor registry |
autodevops | Register and Deploy application |
autodevops-restore-db | - |
mirror-gitlab | Push changes to GitLab |
- Build docker image and register it to GHCR
- uses: SocialGouv/actions/autodevops-build-register@v1
with:
project: "my_product"
imageName: my_product/my_component
token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: "/path/to/Dockerfile" # optional
dockercontext: "/path/to/content" # optional
dockerbuildargs: | # optional
NODE_ENV=production
environment: "preprod" # optional
- Generate kubernetes manifests based on autodevops (
.socialgouv
) config
- uses: SocialGouv/actions/autodevops-manifests@v1
with:
environment: "dev"
productionNamespace: "alternative-namespace" # optional
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}
kosko-args: jobs/restore-db # optional, to generate only some components
- Deploy application over kubernetes
- uses: SocialGouv/actions/autodevops-deploy@v1
id: deploy
with:
environment: "dev"
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
Export main URL as steps.deploy.outputs.url
- Restore database based on autodevops (
.socialgouv
) config
- uses: SocialGouv/actions/autodevops-restore-db@v1
with:
kubeconfig: ${{ secrets.KUBECONFIG }}
- Trigger semantic release run
- uses: SocialGouv/actions/autodevops-release@v1
with:
github-token: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }}
author-name: ${{ secrets.SOCIALGROOVYBOT_NAME }}
author-email: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
- Clean review branches whenever a pull request is closed.
- Drop branch databases
Should be added as .github/workflows/deactivate.yml
in your repo.
name: Deactivate
on:
pull_request:
types: [closed]
jobs:
bury_review_env:
name: Deactivate review branch
runs-on: ubuntu-latest
steps:
- uses: SocialGouv/actions/autodevops-deactivate@v1
with:
kube-config: ${{ secrets.KUBECONFIG }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- Return kubernetes-friendly environment variables
- namespace
- project
- branch
- uses: SocialGouv/actions/autodevops-env@v1
id: env
- shell: bash
run: echo ${{ steps.env.outputs.namespace }}
- Create a dedicated database for a review branch
- uses: SocialGouv/actions/autodevops-create-db@v1
with:
environment: dev
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
- Deploy app/package to target environment
- uses: SocialGouv/actions/autodevops@v1
with:
project: "my_app"
environment: dev # dev, preprod, prod
imageName: my_product/my_app
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}
- Display useful informations from your kubernetes manifests in action log
- Post a sticky comment in associated PR
- Outputs :
markdown
,json
,text
variables
- uses: socialgouv/actions/k8s-manifests-debug@v1
with:
path: kubernetes-manifests.yaml
token: ${{ secrets.GITHUB_TOKEN }}
env:
RANCHER_PROJECT_ID: ${{ secrets.RANCHER_PROJECT_ID }} # optional
see .github/workflows/k8s-manifests-debug-test.yaml
- uses: @socialgouv/actions/containers-cleaner@v1
with:
organization: socialgouv
token: ${{ github.token }}
retention-weeks: '2'
protected-tags: |
^prod$
^latest$
^preprod$
^prod-(\w+)$
^(\d+\.\d+)(\.\d+)?(-(alpha|beta).\d+)?$
containers: |
fabrique/standup
Detailed information here.
- uses: @socialgouv/actions/containers-list@v1
with:
organization: socialgouv