Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 28641dc

Browse files
committed
Add deploy workflow
1 parent a7b6008 commit 28641dc

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Deploy
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
jobs:
9+
macos:
10+
name: Upload macOS release binary
11+
runs-on: macos-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
with:
17+
ref: ${{ github.event.release.tag_name }}
18+
- name: Build
19+
run: make
20+
env:
21+
DEVELOPER_DIR: /Applications/Xcode_12.app/Contents/Developer
22+
- name: Upload
23+
uses: actions/[email protected]
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
upload_url: ${{ github.event.release.upload_url }}
28+
asset_path: ./swift-doc
29+
asset_name: swift-doc-${{ github.event.release.tag_name }}-macos-x86_64
30+
asset_content_type: binary/octet-stream
31+
32+
linux:
33+
name: Upload Linux release binary
34+
35+
runs-on: ubuntu-latest
36+
37+
container:
38+
image: swift:5.3
39+
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v2
43+
with:
44+
ref: ${{ github.event.release.tag_name }}
45+
- name: Install System Dependencies
46+
run: |
47+
apt-get update
48+
apt-get install -y libxml2-dev graphviz
49+
- name: Build
50+
run: make
51+
- name: Upload
52+
uses: actions/[email protected]
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
with:
56+
upload_url: ${{ github.event.release.upload_url }}
57+
asset_path: ./swift-doc
58+
asset_name: swift-doc-${{ github.event.release.tag_name }}-linux-x86_64
59+
asset_content_type: binary/octet-stream
60+
61+
docker:
62+
name: Build and push Docker container
63+
64+
runs-on: ubuntu-latest
65+
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v2
69+
with:
70+
ref: ${{ github.event.release.tag_name }}
71+
- name: Set up QEMU
72+
uses: docker/setup-qemu-action@v1
73+
- name: Set up Docker Buildx
74+
uses: docker/setup-buildx-action@v1
75+
- name: Login to DockerHub
76+
uses: docker/login-action@v1
77+
with:
78+
username: ${{ secrets.DOCKERHUB_USERNAME }}
79+
password: ${{ secrets.DOCKERHUB_TOKEN }}
80+
- name: Build and push
81+
uses: docker/build-push-action@v2
82+
with:
83+
context: .
84+
file: ./Dockerfile
85+
platforms: linux/amd64
86+
push: true
87+
tags: |
88+
swiftdoc/swift-doc:latest
89+
swiftdoc/swift-doc:${{ github.event.release.tag_name }}
90+
91+
homebrew:
92+
name: Update Homebrew formula
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: mislav/bump-homebrew-formula-action@v1
96+
with:
97+
formula-name: swift-doc
98+
homebrew-tap: SwiftDocOrg/homebrew-formulae
99+
base-branch: master
100+
download-url: https://github.com/SwiftDocOrg/swift-doc/archive/${{ github.event.release.tag_name }}.tar.gz
101+
commit-message: "Update formula swift-doc to ${{ github.event.release.tag_name }}"
102+
env:
103+
COMMITTER_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
104+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)