Skip to content

Merge pull request #30 from back-stack/fix-secrets #24

Merge pull request #30 from back-stack/fix-secrets

Merge pull request #30 from back-stack/fix-secrets #24

Workflow file for this run

name: Release
on:
push:
branches:
- main
workflow_dispatch: {}
env:
BACK_STACK_VERSION: v0.1.0
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
CROSSPLANE_VERSION: v1.14.4
PORTER_VERSION: v1.0.15
PORTER_MIXIN_DOCKER_VERSION: v1.0.2
PORTER_MIXIN_KUBERNETES_VERSION: v1.0.3
PORTER_MIXIN_HELM_VERSION: v1.0.1
PORTER_MIXIN_HELM_URL: https://mchorfa.github.io/porter-helm3/atom.xml
jobs:
configuration:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch Package Tag
run: echo "VERSION_TAG=$(git rev-parse --short=8 HEAD)" >> $GITHUB_OUTPUT
id: tag
- name: Log into ${{ env.REGISTRY }}
uses: docker/login-action@v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install crossplane CLI
run: |
curl -Lo /usr/local/bin/crossplane "https://releases.crossplane.io/stable/${{ env.CROSSPLANE_VERSION }}/bin/linux_amd64/crank" \
&& chmod +x /usr/local/bin/crossplane
- name: Build Configuration Package
run: |
crossplane xpkg build --package-root=crossplane/ -o crossplane/back-stack.xpkg
- name: Push ${{ steps.tag.outputs.VERSION_TAG }} & latest
run: |
crossplane xpkg push -f crossplane/back-stack.xpkg ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-configuration:${{ steps.tag.outputs.VERSION_TAG }}
crossplane xpkg push -f crossplane/back-stack.xpkg ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-configuration:latest
backstage:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set tag
run: echo "VERSION_TAG=$(git rev-parse --short=8 HEAD)" >> $GITHUB_OUTPUT
id: tag
- name: Set Node.js 18.x
uses: actions/setup-node@v4.0.2
with:
node-version: 18.x
- name: Log in to the Container registry
uses: docker/login-action@v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run yarn install
uses: borales/actions-yarn@v4
with:
dir: backstage
cmd: install
- name: Build backend bundle
uses: borales/actions-yarn@v4
with:
dir: backstage
cmd: build:backend
- name: Build the image
uses: borales/actions-yarn@v4
with:
dir: backstage
cmd: build-image --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-backstage:${{ steps.tag.outputs.VERSION_TAG }} --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-backstage:latest
# Use docker push command directly to work with docker login action.
- name: Push the image
run: |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-backstage:${{ steps.tag.outputs.VERSION_TAG }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-backstage:latest
bundle:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set tag
run: echo "VERSION_TAG=$(git rev-parse --short=8 HEAD)" >> $GITHUB_OUTPUT
id: tag
- name: Log in to the Container registry
uses: docker/login-action@v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install porter
run: |
curl -L https://cdn.porter.sh/$PORTER_VERSION/install-linux.sh | bash
echo "/home/runner/.porter" >> $GITHUB_PATH
- name: Install porter mixins
run: |
porter mixin install docker --version $PORTER_MIXIN_DOCKER_VERSION && porter mixin install kubernetes --version $PORTER_MIXIN_KUBERNETES_VERSION && porter mixin install helm3 --feed-url $PORTER_MIXIN_HELM_URL --version $PORTER_MIXIN_HELM_VERSION
- name: Build Porter bundle
run: |
porter build --dir bundle --version $BACK_STACK_VERSION+${{ steps.tag.outputs.VERSION_TAG }}
- name: Publish Porter bundle
run: |
porter publish --dir bundle --registry ${{ env.REGISTRY }}/back-stack
porter publish --dir bundle --registry ${{ env.REGISTRY }}/back-stack --tag latest --force