1+ name : Filebrowser docker image
2+
3+ on :
4+ push :
5+ branches :
6+ - ' **'
7+ tags : [ 'v*' ]
8+ pull_request :
9+ branches :
10+ - ' master'
11+
12+ jobs :
13+ generate-filebrowser-image :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - name : Determine Build Environment
17+ id : set-env
18+ run : |
19+ if ${{ github.event_name == 'push' && github.ref_name != 'master' }}; then
20+ echo "DEV environment"
21+ echo "ENV_VERSION=v10-dev" >> $GITHUB_ENV
22+ elif ${{ github.event_name == 'pull_request' && github.base_ref == 'master' }}; then
23+ echo "QA environment"
24+ echo "ENV_VERSION=v10-qa" >> $GITHUB_ENV
25+ elif ${{ github.event_name == 'push' && github.ref_name == 'master'}}; then
26+ echo "RC environment"
27+ echo "ENV_VERSION=v10-rc" >> $GITHUB_ENV
28+ elif ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}; then
29+ echo "PROD environment"
30+ echo "ENV_VERSION=v10" >> $GITHUB_ENV
31+ fi
32+ - name : Check out code into the right branch
33+ uses : actions/checkout@v4
34+ - uses : actions/setup-node@v2
35+ with :
36+ node-version : ' 14'
37+ - name : Set up QEMU
38+ uses : docker/setup-qemu-action@v1
39+ - name : Build frontend
40+ run : make build-frontend
41+ - name : Set up Go 1.x
42+ uses : actions/setup-go@v4
43+ with :
44+ go-version : ^1.20
45+ id : go
46+ - name : Build Binary
47+ run : go build -o "filebrowser" -v .
48+ - name : Login to GitHub Container Registry
49+ uses : docker/login-action@v3
50+ with :
51+ registry : ghcr.io
52+ username : utmstack
53+ password : ${{ secrets.GITHUB_TOKEN }}
54+
55+ - name : Build and Push the Image
56+ uses : docker/build-push-action@v5
57+ with :
58+ context : .
59+ push : true
60+ tags : ghcr.io/utmstack/filebrowser/filebrowser:${{ env.ENV_VERSION }}
61+
0 commit comments