fix(deps): bump tycho.version from 4.0.2 to 4.0.3 #450
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions | |
name: Build | |
on: | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
paths-ignore: | |
- '**/*.adoc' | |
- '**/*.md' | |
- '.github/*.yml' | |
pull_request: | |
repository_dispatch: | |
types: [new-haxe4e-release] | |
workflow_dispatch: | |
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/ | |
inputs: | |
additional_maven_args: | |
description: 'Additional Maven Args' | |
required: false | |
default: '' | |
defaults: | |
run: | |
shell: bash | |
env: | |
JAVA_VERSION: 17 | |
jobs: | |
build: | |
runs-on: windows-latest | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: ${{ github.event_name == 'repository_dispatch' }} | |
steps: | |
- name: Show environment variables | |
run: env | sort | |
- name: Git Checkout | |
uses: actions/checkout@v4 # https://github.com/actions/checkout | |
- name: "Install: JDK ${{ env.JAVA_VERSION }}" | |
uses: actions/setup-java@v3 # https://github.com/actions/setup-java | |
with: | |
distribution: temurin | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: "Cache: Restore" | |
id: cache-restore | |
if: ${{ !env.ACT }} # https://github.com/nektos/act#skipping-steps | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.m2/repository | |
!~/.m2/repository/.cache/tycho/https/raw.githubusercontent.com | |
!~/.m2/repository/*SNAPSHOT* | |
key: ${{ runner.os }}-${{ hashFiles('build.target') }}-${{ hashFiles('**/pom.xml') }} | |
- name: "Install: Maven" | |
uses: stCarolas/[email protected] # https://github.com/stCarolas/setup-maven | |
with: | |
maven-version: 3.9.1 | |
- name: Build with Maven | |
id: maven-build | |
env: | |
GITHUB_USER: ${{ github.actor }} | |
GITHUB_API_KEY: ${{ github.token }} | |
run: | | |
set -eu | |
# https://github.community/t/github-actions-bot-email-address/17204 | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
MAVEN_OPTS="${MAVEN_OPTS:-}" | |
MAVEN_OPTS="$MAVEN_OPTS -XX:+TieredCompilation -XX:TieredStopAtLevel=1" # https://zeroturnaround.com/rebellabs/your-maven-build-is-slow-speed-it-up/ | |
MAVEN_OPTS="$MAVEN_OPTS -Djava.security.egd=file:/dev/./urandom" # https://stackoverflow.com/questions/58991966/what-java-security-egd-option-is-for/59097932#59097932 | |
MAVEN_OPTS="$MAVEN_OPTS -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS" # https://stackoverflow.com/questions/5120470/how-to-time-the-different-stages-of-maven-execution/49494561#49494561 | |
MAVEN_OPTS="$MAVEN_OPTS -Xmx1024m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dhttps.protocols=TLSv1.2" | |
echo " -> MAVEN_OPTS: $MAVEN_OPTS" | |
export MAVEN_OPTS | |
mvn \ | |
--errors \ | |
--update-snapshots \ | |
--batch-mode \ | |
--show-version \ | |
--no-transfer-progress \ | |
-s .ci/maven-settings.xml \ | |
-t .ci/maven-toolchains.xml \ | |
-Dtycho.disableP2Mirrors=true \ | |
${{ github.event.inputs.additional_maven_args }} \ | |
clean verify | |
python product/fix_exec_flag_in_archives.py | |
mv product/target/products/org.haxe4e.studio-win32.win32.x86_64.zip \ | |
product/target/products/org.haxe4e.studio-win.x86_64.zip | |
- name: Generate PortableApps archive | |
run: | | |
bash product/build-paf.sh | |
- name: "Delete previous 'latest' release" | |
if: ${{ github.ref == 'refs/heads/main' && !env.ACT }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -eu | |
api_base_url="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY" | |
# delete 'latest' github release | |
release_id=$(curl -fsL -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r '.[] | select(.name == "latest") | .id') | |
if [[ -n $release_id ]]; then | |
echo "Deleting release [$api_base_url/releases/$release_id]..." | |
curl -H "Authorization: token $GITHUB_TOKEN" -fsSL -X DELETE "$api_base_url/releases/$release_id" | |
fi | |
# delete 'latest' git tag | |
tag_url="$api_base_url/git/refs/tags/latest" | |
if curl -H "Authorization: token $GITHUB_TOKEN" -fsLo /dev/null --head "$tag_url"; then | |
echo "Deleting tag [$tag_url]..." | |
curl -H "Authorization: token $GITHUB_TOKEN" -fsSL -X DELETE "$tag_url" | |
fi | |
- name: "Create 'latest' release" | |
if: ${{ github.ref == 'refs/heads/main' && !env.ACT }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -eux | |
# https://hub.github.com/hub-release.1.html | |
hub release create "latest" \ | |
--message "latest" \ | |
--attach "product/target/products/org.haxe4e.studio-linux.gtk.x86_64.tar.gz" \ | |
--attach "product/target/products/org.haxe4e.studio-macosx.cocoa.x86_64.tar.gz" \ | |
--attach "product/target/products/org.haxe4e.studio-win.x86_64.zip" \ | |
--attach "product/target/HaxeStudioPortable.paf.exe" \ | |
--prerelease | |
- name: Deploy p2 update site | |
if: ${{ github.ref == 'refs/heads/main' && !env.ACT }} | |
run: | | |
set -eux | |
cd /tmp | |
github_repo_url="https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}" | |
if curl --output /dev/null --silent --head --fail "$github_repo_url/tree/updatesite"; then | |
git clone $github_repo_url --single-branch --branch updatesite updatesite | |
cd updatesite | |
# https://github.community/t/github-actions-bot-email-address/17204 | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git reset --hard HEAD^ | |
else | |
git clone $github_repo_url updatesite | |
cd updatesite | |
git checkout --orphan updatesite | |
git rm -rf . | |
cat <<EOF > index.html | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>${{ github.repository }} - Update Site</title> | |
</head> | |
<body> | |
<h1>${{ github.repository }} - Update Site</h1> | |
</body> | |
</html> | |
EOF | |
git add index.html | |
# https://github.community/t/github-actions-bot-email-address/17204 | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git commit -am "Initialize Update Site" | |
fi | |
mv $(cygpath $GITHUB_WORKSPACE)/product/target/repository/* . | |
git add --all | |
git commit -am "deploy p2 update site" | |
git push origin updatesite --force | |
################################################## | |
# Cache Update | |
# See https://github.com/actions/cache/issues/342 | |
################################################## | |
- name: "Cache: Delete Previous" | |
if: ${{ steps.cache-restore.outputs.cache-hit && !env.ACT }} | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh extension install actions/gh-actions-cache | |
gh actions-cache delete ${{ steps.cache-restore.outputs.cache-primary-key }} --confirm | |
- name: "Cache: Update" | |
uses: actions/cache/save@v3 | |
if: ${{ always() && !cancelled() && !env.ACT }} # save cache even fails | |
with: | |
path: | | |
~/.m2/repository | |
!~/.m2/repository/.cache/tycho/https/raw.githubusercontent.com | |
!~/.m2/repository/*SNAPSHOT* | |
key: ${{ steps.cache-restore.outputs.cache-primary-key }} |