Skip to content

Commit

Permalink
Fix server builds upload paths (#791)
Browse files Browse the repository at this point in the history
* Fix build server upload paths

* Test

* Test

* Make job create staging dir

* Keep testing

* Remove test entries
  • Loading branch information
pierd authored Sep 4, 2023
1 parent 141b278 commit 8549067
Showing 1 changed file with 17 additions and 28 deletions.
45 changes: 17 additions & 28 deletions .github/workflows/build-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
BUILD_DIR: build-${{ github.sha }}
SERVER_BINARY_NAME: ambient-${{ github.sha }}
CANARY_SERVER_BINARY_NAME: ambient-0.3.0-dev

Expand Down Expand Up @@ -62,7 +63,8 @@ jobs:
run: |
raw_image_name="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ github.sha }}"
container_id=$(docker create "${raw_image_name,,}")
docker cp "$container_id:/app/ambient" "${{ env.SERVER_BINARY_NAME }}"
mkdir -p "${{ env.BUILD_DIR }}"
docker cp "$container_id:/app/ambient" "${{ env.BUILD_DIR }}/${{ env.SERVER_BINARY_NAME }}"
docker rm "$container_id"
- name: Authenticate with Google Cloud
Expand All @@ -74,40 +76,27 @@ jobs:
service_account: [email protected]
access_token_lifetime: 1800s

- name: Upload ambient server binary
uses: google-github-actions/upload-cloud-storage@v1
with:
path: ${{ env.SERVER_BINARY_NAME }}
destination: ambient-artifacts/ambient-server-builds

- name: Upload Canary to Google Cloud
- name: Prepare canary
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: google-github-actions/upload-cloud-storage@v1
with:
path: ${{ env.SERVER_BINARY_NAME }}
destination: "ambient-artifacts/ambient-server-builds/${{ env.CANARY_SERVER_BINARY_NAME }}"
parent: false
shell: bash
run:
cp "${{ env.BUILD_DIR }}/${{ env.SERVER_BINARY_NAME }}" "${{ env.BUILD_DIR }}/${{ env.CANARY_SERVER_BINARY_NAME }}"

- name: Set version
- name: Prepare versioned
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
shell: bash
- name: Upload version to Google Cloud
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: google-github-actions/upload-cloud-storage@v1
with:
path: ${{ env.SERVER_BINARY_NAME }}
destination: "ambient-artifacts/ambient-server-builds/ambient-${{ env.version }}"
parent: false
run:
cp "${{ env.BUILD_DIR }}/${{ env.SERVER_BINARY_NAME }}" "${{ env.BUILD_DIR }}/ambient-${GITHUB_REF#refs/tags/v}"

- name: Set date suffix
- name: Prepare nightly
if: github.event_name == 'schedule'
run: echo "date_suffix=$(date +%Y-%m-%d)" >> $GITHUB_ENV
shell: bash
- name: Upload nightly to Google Cloud
if: github.event_name == 'schedule'
run:
cp "${{ env.BUILD_DIR }}/${{ env.SERVER_BINARY_NAME }}" "${{ env.BUILD_DIR }}/ambient-nightly-$(date +%Y-%m-%d)"

- name: Upload ambient server binary
uses: google-github-actions/upload-cloud-storage@v1
with:
path: ${{ env.SERVER_BINARY_NAME }}
destination: "ambient-artifacts/ambient-server-builds/ambient-nightly-${{ env.date_suffix }}"
path: ${{ env.BUILD_DIR }}
destination: ambient-artifacts/ambient-server-builds
parent: false

0 comments on commit 8549067

Please sign in to comment.