-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (110 loc) · 4.45 KB
/
auto-release.yml
File metadata and controls
127 lines (110 loc) · 4.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Auto Release
on:
schedule:
- cron: '0 0 * * *' # daily at 00:00 UTC
workflow_dispatch: # manual trigger via `Actions` tab
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
attestations: write
id-token: write
steps:
- name: Enable QEMU for multi-arch support
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Boot up Buildx
uses: docker/setup-buildx-action@v2
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags for release checking
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch latest TailwindCSS release
id: get-latest-release
uses: pozetroninc/github-action-get-latest-release@v0.8.0
with:
repository: tailwindlabs/tailwindcss
- name: Strip leading "v" from version
id: strip-v
run: |
# grab the raw output (e.g. "v4.1.7")
vtag="${{ steps.get-latest-release.outputs.release }}"
# remove one leading "v"
clean_vtag="${vtag#v}"
# expose it as an output
echo "version_no_v=${clean_vtag}" >> $GITHUB_OUTPUT
echo "full_version=${vtag}" >> $GITHUB_OUTPUT
- name: Check if release already exists
id: check-release
run: |
# Check if we already have a release for this version
version="${{ steps.strip-v.outputs.full_version }}"
if git tag -l | grep -q "^${version}$"; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Release ${version} already exists, skipping build"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Release ${version} does not exist, will build and create"
fi
- name: Build & push multi-arch
if: steps.check-release.outputs.exists == 'false' # Only build if new version
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64, linux/arm64
tags: |
ghcr.io/scriptogre/tailwindcss:latest
ghcr.io/scriptogre/tailwindcss:${{ steps.strip-v.outputs.version_no_v }}
build-args: |
TAILWINDCSS_VERSION=${{ steps.strip-v.outputs.version_no_v }}
- name: Create and push tag
if: steps.check-release.outputs.exists == 'false'
run: |
version="${{ steps.strip-v.outputs.full_version }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "${version}" -m "Auto-release for TailwindCSS ${version}"
git push origin "${version}"
- name: Create GitHub Release
if: steps.check-release.outputs.exists == 'false'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.strip-v.outputs.full_version }}
name: ${{ steps.strip-v.outputs.full_version }}
body: |
Automatic release for TailwindCSS ${{ steps.strip-v.outputs.full_version }}
1. Create `input.css` in your project:
```css
@import 'tailwindcss';
```
2. Create `docker-compose.yml` in your project:
```yaml
services:
tailwindcss:
image: ghcr.io/scriptogre/tailwindcss:${{ steps.strip-v.outputs.version_no_v }}
tty: true # Required for watch mode
volumes:
- .:/app
command: -i ./input.css -o ./output.css --watch
```
3. Or run `docker run` command (note the `-t` flag is required for watch mode):
```bash
docker run -t -v "$(pwd)":/app \
ghcr.io/scriptogre/tailwindcss:${{ steps.strip-v.outputs.version_no_v }} -i ./input.css -o ./output.css --watch
```
Container available at [ghcr.io/scriptogre/tailwindcss:${{ steps.strip-v.outputs.version_no_v }}](https://ghcr.io/scriptogre/tailwindcss:${{ steps.strip-v.outputs.version_no_v }})
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}