This repository was archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
Trigger publish from release workflow #193
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [created, published] | ||
|
||
jobs: | ||
formula: | ||
name: Update Homebrew formula | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update the Homebrew formula with latest release | ||
uses: NSHipster/update-homebrew-formula-action@main | ||
with: | ||
repository: SwiftDocOrg/swift-doc | ||
tap: SwiftDocOrg/homebrew-formulae | ||
formula: Formula/swift-doc.rb | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
bottle: | ||
name: Build and distribute Homebrew bottle for macOS Catalina | ||
runs-on: macos-10.15 | ||
needs: [formula] | ||
steps: | ||
- name: Build a bottle using Homebrew | ||
run: | | ||
brew tap swiftdocorg/formulae | ||
brew install --build-bottle --verbose swift-doc | ||
brew bottle swift-doc | ||
- name: Upload the bottle to the GitHub release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./swift-doc--${{ github.event.release.tag_name }}.catalina.bottle.tar.gz | ||
asset_name: swift-doc-${{ github.event.release.tag_name }}.catalina.bottle.tar.gz | ||
asset_content_type: application/gzip | ||
- name: Update the Homebrew formula again with bottle | ||
uses: NSHipster/update-homebrew-formula-action@main | ||
with: | ||
repository: SwiftDocOrg/swift-doc | ||
tap: SwiftDocOrg/homebrew-formulae | ||
formula: Formula/swift-doc.rb | ||
message: | | ||
Add bottle for swift-doc ${{ github.event.release.tag_name }} | ||
on macOS Catalina | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
docker: | ||
name: Build and push Docker container | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.release.tag_name }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
tags: | | ||
swiftdoc/swift-doc:latest | ||
swiftdoc/swift-doc:${{ github.event.release.tag_name }} |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what's the difference between these two? It doesn't seem to be documented in the trigger events doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure, but GitHub's UI copy gives us some clue. On the releases page, the button says "Draft a new release". On that page, there are two buttons, "Publish release" or "Save as draft". The former likely corresponds to a
published
event, and the latter may trigger acreated
step.Here, we're creating a release through the
github/create-release
action, whose name implies acreated
event, but I vaguely recall triggeringpublished
instead. It's really too bad that there's no easy way to do a dry run of this.