Skip to content

wip 1719882115

wip 1719882115 #20

name: Publish Habitat Packages
on:
push:
# JAH: trigger more appropriately once development is done
# branches:
# - main
# release:
# types:
# - created
env:
BLDR_URL: 'https://bldr.habitat.sh/'
# HAB_ORIGIN: 'habitat'
HAB_ORIGIN: 'jasonheath'
HAB_AUTH_TOKEN: ${{ secrets.HAB_AUTH_TOKEN }}
HABITAT_VERSION_SET: 'latest'
HAB_STUDIO_SECRET_GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
permissions:
contents: write
jobs:
windows-pre-build:
runs-on: ubuntu-latest
outputs:
app_version: ${{ steps.app_version.outputs.APP_VERSION }}
date: ${{ steps.date.outputs.DATE }}
steps:
- name: Get branch name
id: get_branch_name
run: |
echo "BRANCH_NAME=${GITHUB_REF_NAME//\//-}" >> "$GITHUB_OUTPUT"
- name: Get formated date
id: date
run: |
echo "DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> "$GITHUB_OUTPUT"
- name: Get version from tag
id: app_version
run: |
echo "APP_VERSION=$(git describe --tags `git rev-list --tags --max-count=1` | sed 's/^v//')" >> "$GITHUB_OUTPUT"
# These particular components
# - have a plan.sh file in their "component root"
# - don't have a habitat plan directory
# - don't have a habitat-dev plan directory
# - don't have architecture specific plan directories
plan-file-packages:
name: ${{matrix.components}} hab pkg (plan file)
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
channel: [unstable]
components: [builder-memcached, builder-datastore]
runs-on: ${{matrix.os}}
steps:
- name: Checkout for ${{matrix.components}}
uses: actions/checkout@v4
- name: Install Habitat for ${{matrix.components}}
uses: ./.github/actions/hab-install-linux
- name: Build and Upload Habitat Package for ${{matrix.components}}
uses: ./.github/actions/hab-pkg-build-and-upload-linux
with:
hab-auth-token: ${{ env.HAB_AUTH_TOKEN }}
hab-origin: ${{ env.HAB_ORIGIN }}
bldr-component: components/${{matrix.components}}
# These particular components
# - don't have a plan.sh file in their "component root"
# - have a habitat plan directory
# - don't have a habitat-dev plan directory
# - don't have architecture specific plan directories
habitat-dir-packages:
name: ${{matrix.components}} hab pkg (habitat dir)
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
channel: [unstable]
components: [builder-api, builder-graph, builder-jobsrv, builder-minio]
# components: [builder-api, builder-api-proxy, builder-graph, builder-jobsrv, builder-minio]
runs-on: ${{matrix.os}}
steps:
- name: Checkout for ${{matrix.components}}
uses: actions/checkout@v4
- name: Install Habitat for ${{matrix.components}}
uses: ./.github/actions/hab-install-linux
- name: Build and Upload Habitat Package for ${{matrix.components}}
uses: ./.github/actions/hab-pkg-build-and-upload-linux
with:
hab-auth-token: ${{ env.HAB_AUTH_TOKEN }}
hab-origin: ${{ env.HAB_ORIGIN }}
bldr-component: components/${{matrix.components}}/habitat
- name: Upload HART file artifact for reuse in habitat-dev plans
uses: actions/upload-artifact@v4
with:
name: hart-files
path: results/${{env.HAB_ORIGIN}}*.hart
if-no-files-found: error
retention-days: 1
compression-level: 0
overwrite: true
# These particular sub-components of builder-worker
# - don't have a plan.sh file in their "component root"
# - don't have a habitat plan directory
# - don't have a habitat-dev plan directory
# - have architecture specific plan directories
arch-target-packages:
name: ${{matrix.arches}} ${{matrix.components}} hab pkg (plan file)
needs: windows-pre-build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
channel: [unstable]
components: [builder-worker]
arches: [x86_64-linux, x86_64-linux-kernel2, x86_64-windows]
exclude:
- os: ubuntu-latest
arches: x86_64-windows
- os: windows-latest
arches: x86_64-linux
- os: windows-latest
arches: x86_64-linux-kernel2
runs-on: ${{matrix.os}}
steps:
- name: Checkout
uses: actions/checkout@v4
- if: ${{ matrix.os == 'ubuntu-latest' && matrix.arches != 'x86_64-windows' }}
name: Install Habitat
uses: ./.github/actions/hab-install-linux
- if: ${{ matrix.os == 'windows-latest' && matrix.arches == 'x86_64-windows' }}
name: Install Habitat
uses: ./.github/actions/hab-install-windows
- if: ${{ matrix.os == 'ubuntu-latest' && matrix.arches != 'x86_64-windows' }}
name: Build and Upload Habitat Package
uses: ./.github/actions/hab-pkg-build-and-upload-linux
with:
hab-auth-token: ${{ env.HAB_AUTH_TOKEN }}
hab-origin: ${{ env.HAB_ORIGIN }}
bldr-component: components/${{matrix.components}}/habitat/${{matrix.arches}}
- if: ${{ matrix.os == 'windows-latest' && matrix.arches == 'x86_64-windows' }}
name: Build and Upload Habitat Package
uses: ./.github/actions/hab-pkg-build-and-upload-windows
with:
hab-auth-token: ${{ env.HAB_AUTH_TOKEN }}
hab-origin: ${{ env.HAB_ORIGIN }}
bldr-component: components/${{matrix.components}}/habitat/${{matrix.arches}}
app-version: ${{ needs.pre-build.outputs.app_version }}
build-date-time: ${{ needs.pre-build.outputs.date }}
- name: Upload HART file artifact for reuse in habitat-dev plans
uses: actions/upload-artifact@v4
with:
name: hart-files
path: results/${{env.HAB_ORIGIN}}*.hart
if-no-files-found: error
retention-days: 1
compression-level: 0
overwrite: true
# These particular components
# - don't have a plan.sh file in their "component root"
# - don't have a habitat plan directory
# - have a habitat-dev plan directory
# - don't have architecture specific plan directories
habitat-dev-dir-packages:
name: ${{matrix.components}} hab pkg (habitat-dev dir)
needs: [habitat-dir-packages, arch-target-packages]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
channel: [unstable]
components: [builder-api, builder-api-proxy, builder-jobsrv, builder-worker]
runs-on: ${{matrix.os}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Habitat
uses: ./.github/actions/hab-install-linux
- name: Download HART file we need here previouisly built in "habitat-dir-components" job
uses: actions/download-artifact@v4
with:
name: hart-files
path: /hab/cache/artifacts/
- name: Build and Upload Habitat Package
uses: ./.github/actions/hab-pkg-build-and-upload-linux
with:
hab-auth-token: ${{ env.HAB_AUTH_TOKEN }}
hab-origin: ${{ env.HAB_ORIGIN }}
bldr-component: components/${{matrix.components}}/habitat-dev
# JAH: trigger appropriately
# JAH: Set the hab_auth_token more appropriately
# JAH: stop using jasonheath origin
# JAH: fix broken builder-api-proxy