Skip to content

Commit

Permalink
ci: auto-upload release assets on release event (#3469)
Browse files Browse the repository at this point in the history
note: used download-artifact to upload the artifacts since we don't want
to learn how to write a windows script in the windows-build workflow

also:
* removed the ghcr build on tag events (since it's redundant with the
  release event and we end up with orphaned images, since two images get
  tagged with ex. v0.3.9)
* rename some workflows for clarity
  • Loading branch information
charles-cooper authored May 30, 2023
1 parent 66b9670 commit e97e9f2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 11 deletions.
37 changes: 32 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: Artifacts
name: Build and release artifacts

on:
workflow_dispatch:
inputs:
tag:
default: ''
push:
tags:
- '*'
branches:
- master
release:
types: [released]

defaults:
run:
Expand All @@ -23,7 +23,7 @@ jobs:
os: [ubuntu-20.04, macos-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
# grab the commit passed in via `tag`, if any
ref: ${{ github.event.inputs.tag }}
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
# grab the commit passed in via `tag`, if any
ref: ${{ github.event.inputs.tag }}
Expand All @@ -74,3 +74,30 @@ jobs:
uses: actions/upload-artifact@v3
with:
path: dist/vyper.*

publish-release-assets:
needs: [windows-build, unix-build]
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: artifacts/

- name: Upload assets
# fun - artifacts are downloaded into "artifact/".
working-directory: artifacts/artifact
run: |
set -Eeuxo pipefail
for BIN_NAME in $(ls)
do
curl -L \
--no-progress-meter \
-X POST \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"\
-H "Content-Type: application/octet-stream" \
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets?name=${BIN_NAME}" \
--data-binary "@${BIN_NAME}"
done
2 changes: 1 addition & 1 deletion .github/workflows/era-tester.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: era compiler tester
name: Era compiler tester

# run the matter labs compiler test to integrate their test cases
# this is intended as a diagnostic / spot check to check that we
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ name: Deploy docker image to ghcr

on:
push:
tags:
- '*'
branches:
- master
release:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflows will upload a Python Package using Twine when a release is created
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Publish
name: Publish to PyPI

on:
release:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: Run test suite

on: [push, pull_request]

Expand Down

0 comments on commit e97e9f2

Please sign in to comment.