Skip to content

Commit 1641575

Browse files
authored
Trigger publish from release workflow (SwiftDocOrg#193)
* Rename Deploy workflow to Publish * Pass GH_PERSONAL_ACCESS_TOKEN as GITHUB_TOKEN * Update publish workflow
1 parent adc3fc1 commit 1641575

File tree

3 files changed

+81
-117
lines changed

3 files changed

+81
-117
lines changed

.github/workflows/deploy.yml

Lines changed: 0 additions & 116 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [created, published]
6+
7+
jobs:
8+
formula:
9+
name: Update Homebrew formula
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Update the Homebrew formula with latest release
13+
uses: NSHipster/update-homebrew-formula-action@main
14+
with:
15+
repository: SwiftDocOrg/swift-doc
16+
tap: SwiftDocOrg/homebrew-formulae
17+
formula: Formula/swift-doc.rb
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
21+
bottle:
22+
name: Build and distribute Homebrew bottle for macOS Catalina
23+
runs-on: macos-10.15
24+
needs: [formula]
25+
steps:
26+
- name: Build a bottle using Homebrew
27+
run: |
28+
brew tap swiftdocorg/formulae
29+
brew install --build-bottle --verbose swift-doc
30+
brew bottle swift-doc
31+
- name: Upload the bottle to the GitHub release
32+
uses: actions/upload-release-asset@v1.0.1
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
upload_url: ${{ github.event.release.upload_url }}
37+
asset_path: ./swift-doc--${{ github.event.release.tag_name }}.catalina.bottle.tar.gz
38+
asset_name: swift-doc-${{ github.event.release.tag_name }}.catalina.bottle.tar.gz
39+
asset_content_type: application/gzip
40+
- name: Update the Homebrew formula again with bottle
41+
uses: NSHipster/update-homebrew-formula-action@main
42+
with:
43+
repository: SwiftDocOrg/swift-doc
44+
tap: SwiftDocOrg/homebrew-formulae
45+
formula: Formula/swift-doc.rb
46+
message: |
47+
Add bottle for swift-doc ${{ github.event.release.tag_name }}
48+
on macOS Catalina
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
52+
docker:
53+
name: Build and push Docker container
54+
55+
runs-on: ubuntu-latest
56+
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v2
60+
with:
61+
ref: ${{ github.event.release.tag_name }}
62+
- name: Set up QEMU
63+
uses: docker/setup-qemu-action@v1
64+
- name: Set up Docker Buildx
65+
uses: docker/setup-buildx-action@v1
66+
- name: Login to DockerHub
67+
uses: docker/login-action@v1
68+
with:
69+
username: ${{ secrets.DOCKERHUB_USERNAME }}
70+
password: ${{ secrets.DOCKERHUB_TOKEN }}
71+
- name: Build and push
72+
uses: docker/build-push-action@v2
73+
with:
74+
context: .
75+
file: ./Dockerfile
76+
platforms: linux/amd64
77+
push: true
78+
tags: |
79+
swiftdoc/swift-doc:latest
80+
swiftdoc/swift-doc:${{ github.event.release.tag_name }}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Create Release
2727
uses: actions/create-release@v1
2828
env:
29-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
3030
with:
3131
tag_name: ${{ github.ref }}
3232
release_name: ${{ github.ref }}

0 commit comments

Comments
 (0)