Skip to content

Commit

Permalink
Try an e2e build.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Mar 29, 2024
1 parent 84af5b2 commit 1230bca
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 26 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/build-and-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
# This workflow uses actions that are not certified by GitHub. They are provided
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.

name: "Step: Build and cache"
on:
workflow_call:
inputs:
package-name:
required: true
type: string
package-version:
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Variables available to all jobs defined in this file
env:
DOCKER_BUILDKIT: 1
REGISTRY: ${{ vars.REGISTRY }}

# Declare default permissions as read only.
permissions: read-all

jobs:
generate:
runs-on: ubuntu-latest
name: Build and cache
strategy:
fail-fast: false

container:
image: ghcr.io/northwood-labs/package-builder/ubuntu-v22.04:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
options: --privileged

steps:
- name: Build the package
working-directory: ./packages/${{ inputs.package-name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
run: |
# We just need to set a git tag. None of the rest of this matters.
git init
git config user.email "[email protected]"
git config user.name "Your Name"
git add .
git commit -m "Test"
git remote add origin https://example.com
git tag "${{ inputs.package-version }}"
# Build the package
goreleaser release --clean --nightly --skip=announce,publish,validate
- name: Cache the packages
uses: actions/cache/save@v4
id: cache-packages
with:
key: "${{ inputs.package-name }}-${{ inputs.package-version }}"
path: packages/${{ inputs.package-name }}/dist
37 changes: 11 additions & 26 deletions .github/workflows/build-tenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,42 +73,27 @@ jobs:
run: |
echo "::add-mask::${AWSSSEKMSID}"
# We'll use amzn2-x86_64 as a proxy for all packages pushed to S3.
aws s3api head-object \
--bucket "${PACKAGE_BUCKET}" \
--key "rpm/amazonlinux/2/x86_64/tenv-${package_version}-1.x86_64.rpm" 2>&1 \
&& echo "::notice title=Package exists::We don't need to rebuild, so let's stop the build here." \
&& echo "already_built=true" >> $GITHUB_OUTPUT \
|| true
- name: Build the package
if: steps.check.outputs.already_built != 'true'
working-directory: ./packages/tenv
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
run: |
# We just need to set a git tag. None of the rest of this matters.
git init
git config user.email "[email protected]"
git config user.name "Your Name"
git add .
git commit -m "Test"
git remote add origin https://example.com
git tag "${package_version}"
# Build the package
goreleaser release --clean --nightly --skip=announce,publish,validate
- name: Cache the packages
uses: actions/cache/save@v4
id: cache-packages
with:
key: "tenv-${package_version}"
path: packages/tenv/dist
build:
if: needs.lookup.outputs.already_built != 'true'
needs: lookup
name: Build and cache
uses: northwood-labs/package-building/.github/workflows/build-and-cache.yml@main
secrets: inherit
with:
package-name: tenv
package-version: "${package_version}"

upload:
if: needs.lookup.outputs.already_built != 'true'
needs: lookup
needs: build
name: Upload to S3
uses: northwood-labs/package-building/.github/workflows/upload-to-s3.yml@main
secrets: inherit
Expand Down

0 comments on commit 1230bca

Please sign in to comment.