Skip to content

Commit

Permalink
feat(website): Build website and publish only whe tagged
Browse files Browse the repository at this point in the history
Signed-off-by: Helio Chissini de Castro <[email protected]>
  • Loading branch information
heliocastro committed Dec 28, 2023
1 parent 15a67c4 commit a6348e1
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: Build and Archive
on:
push:
tags: v*
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build-archive:
build_website:
name: Build Main Website Documentation
runs-on: ubuntu-latest
env:
PROJECT_NAME: sw360
Expand Down Expand Up @@ -47,8 +50,38 @@ jobs:
mkdir -p themes/docsy
hugo --minify -b 'https://www.eclipse.org/sw360/'
archive_publish:
name: Archive and Published Tagged Build
runs-on: ubuntu-latest
needs: [build_website]
steps:
- name: Archive
uses: actions/upload-artifact@v2
with:
name: website
path: ./public
if: startsWith(github.ref, 'refs/tags/')

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
if: startsWith(github.ref, 'refs/tags/')

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./public
asset_name: website.zip
asset_content_type: application/zip
if: startsWith(github.ref, 'refs/tags/')

0 comments on commit a6348e1

Please sign in to comment.