Skip to content

Commit b1a0294

Browse files
TylopilusHelge Ahrens
andauthored
Github actions (#2)
* modified actions * modified actions * modified actions * modified action * modified action Co-authored-by: Helge Ahrens <helgeahrens@MacBook-Pro-2.local>
1 parent 09504e7 commit b1a0294

1 file changed

Lines changed: 93 additions & 26 deletions

File tree

.github/workflows/maven.yml

Lines changed: 93 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,106 @@
1-
# This workflow will build a Java project with Maven
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
1+
# Creates a Site Template Release
32

4-
name: Maven CI
3+
name: Build and release Package
54

65
on:
7-
pull_request:
6+
workflow_dispatch:
7+
inputs:
8+
semantic_version:
9+
description: 'Semantic version (major | minor | patch)'
10+
required: true
11+
default: 'patch'
812

913
jobs:
10-
build:
11-
runs-on: ${{ matrix.os }}
12-
strategy:
13-
matrix:
14-
os: [ubuntu-latest]
15-
java: [8, 11]
16-
profile: ['', '-Pclassic']
14+
build_and_release:
15+
name: Build and release
16+
runs-on: ubuntu-latest
1717

18-
steps:
19-
# Check out Git repository
20-
- name: Checkout code
21-
uses: actions/checkout@v2
18+
if: github.ref == 'refs/heads/main'
2219

23-
# Set up environment with Java and Maven
24-
- name: Setup JDK
25-
uses: actions/setup-java@v1
26-
with:
27-
java-version: ${{ matrix.java }}
20+
steps:
21+
- uses: actions/checkout@v2
2822

29-
# Set up dependency cache
3023
- name: Cache local Maven repository
3124
uses: actions/cache@v2
3225
with:
3326
path: ~/.m2/repository
3427
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
35-
restore-keys: |
36-
${{ runner.os }}-maven-
37-
# Build & Test
38-
- name: Build & Test with Maven
39-
run: mvn clean install ${{ matrix.profile }}
28+
restore-keys: ${{ runner.os }}-maven-
29+
30+
- name: Set up Java
31+
uses: actions/setup-java@v1
32+
with:
33+
java-version: 11
34+
server-id: github
35+
36+
- name: Configure Git user
37+
run: |
38+
git config user.email "actions@github.com"
39+
git config user.name "GitHub Actions"
40+
41+
- name: Get Version from pom
42+
run: echo '::set-output name=BUILD_VERSION::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)'
43+
id: pom-version
44+
45+
- name: Check output
46+
run: echo '${{steps.pom-version.outputs.BUILD_VERSION}}'
47+
48+
- name: Build Maven artifact
49+
run: mvn clean install
50+
51+
# - name: Bump version and commit
52+
# run: |
53+
# git config --local user.email "${{ github.actor }}@users.noreply.github.com"
54+
# git config --local user.name "Release action on behalf of ${{ github.actor }}"
55+
# npm version ${{ github.event.inputs.semantic_version }} -m 'Release %s'
56+
# - name: Push changes
57+
# uses: ad-m/github-push-action@master
58+
# with:
59+
# github_token: ${{ secrets.GITHUB_TOKEN }}
60+
# branch: ${{ github.ref }}
61+
# tags: false
62+
63+
# - name: Build Site Template (using bumped version)
64+
# run: npm run build
65+
66+
# - name: Read package.json
67+
# id: package
68+
# uses: juliangruber/read-file-action@v1
69+
# with:
70+
# path: ./package.json
71+
72+
# - name: Extract name and version from package.json
73+
# id: packageJson
74+
# run: |
75+
# echo ::set-output name=NAME::$(echo '${{ steps.package.outputs.content }}' | jq -r '.name')
76+
# echo ::set-output name=VERSION::$(echo '${{ steps.package.outputs.content }}' | jq -r '.version')
77+
78+
- name: Create Release
79+
id: create_release
80+
uses: actions/create-release@v1
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
with:
84+
tag_name: ${{steps.pom-version.outputs.*}}
85+
release_name: ${{steps.pom-version.outputs.*}}
86+
draft: false
87+
prerelease: true
88+
89+
- name: Upload Release Asset
90+
id: upload-release-asset
91+
uses: actions/upload-release-asset@v1
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
with:
95+
upload_url: ${{ steps.create_release.outputs.upload_url }}
96+
asset_path: ./all/target/graphql-voyager.all-1.0.0-SNAPSHOT.zip
97+
asset_name: graphql-voyager.all-1.0.0-SNAPSHOT.zip
98+
asset_content_type: application/zip
99+
100+
# - name: Update Site Theme E2E Repo
101+
# run: |
102+
# curl -H "Accept: application/vnd.github.v3+json" \
103+
# -H "Authorization: token ${{ secrets.SITE_THEME_REPO_WRITE_TOKEN }}" \
104+
# --request POST \
105+
# --data '{"event_type": "fetch_latest_changes", "client_payload": { "site_template_version": "${{ steps.packageJson.outputs.VERSION }}" } }' \
106+
# ${{ github.api_url }}/repos/adobe/aem-site-template-basic-theme-e2e/dispatches

0 commit comments

Comments
 (0)