Try an e2e build. #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# 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: Build tenv | |
on: | |
push: | |
branches: [main] | |
paths: | |
- ".github/workflows/build-tenv.yml" | |
pull_request: | |
branches: [main] | |
paths: | |
- ".github/workflows/build-tenv.yml" | |
# First lookup the current version. | |
# Then detect if we've already built it. | |
# If we have, then we can skip the build. | |
# Else, we need to build it. | |
# 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: | |
lookup: | |
runs-on: ubuntu-latest | |
name: Lookup current version | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
fail-fast: false | |
container: | |
image: ghcr.io/northwood-labs/package-builder/ubuntu-v22.04:latest | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Git clone | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Lookup latest version of package | |
id: lookup_version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "Lookup version" | |
echo "package_version=$( | |
download-asset latest-tag -r tofuutils/tenv -s | |
)" >> $GITHUB_ENV | |
- name: Check to see if we've already built this version | |
run: | | |
echo "TODO: Check version" | |
- name: Build the package | |
working-directory: ./packages/tenv | |
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 "${{ steps.lookup_version.outputs.package_version }}" | |
# Build the package | |
goreleaser release --clean --nightly --skip=announce,publish,validate | |
- name: Upload to S3 | |
working-directory: ./packages/tenv | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }} | |
AWS_REGION: ${{ vars.AWS_REGION }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
KMS_KEY_ID: "${{ secrets.KMS_KEY_ID }}" | |
PACKAGE_BUCKET: ${{ vars.PACKAGE_BUCKET }} | |
run: | | |
# rpm, x86_64 | |
aws s3 cp --sse=aws:kms --sse-kms-key-id="${KMS_KEY_ID}" tenv*.x86_64.rpm "s3://${PACKAGE_BUCKET}/rpm/amazonlinux/2/x86_64/" | |
aws s3 cp --sse=aws:kms --sse-kms-key-id="${KMS_KEY_ID}" tenv*.x86_64.rpm "s3://${PACKAGE_BUCKET}/rpm/amazonlinux/2023/x86_64/" | |
# rpm, aarch64 | |
aws s3 cp --sse=aws:kms --sse-kms-key-id="${KMS_KEY_ID}" tenv*.aarch64.rpm "s3://${PACKAGE_BUCKET}/rpm/amazonlinux/2/aarch64/" | |
aws s3 cp --sse=aws:kms --sse-kms-key-id="${KMS_KEY_ID}" tenv*.aarch64.rpm "s3://${PACKAGE_BUCKET}/rpm/amazonlinux/2023/aarch64/" | |
metadata: | |
needs: lookup | |
name: Generate metadata | |
uses: northwood-labs/package-building/.github/workflows/generate-rpm-meta.yml@main | |
secrets: inherit |