Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI/CD conceptualisation: Template Workflows #15562

Draft
wants to merge 34 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
490a3c2
set distributionManagement repos to local
RaveenaRamany Dec 10, 2023
ccabc97
Merge pull request #1 from RaveenaRamany/features/migration-cyberduck…
RaveenaRamany Dec 10, 2023
7c6015a
Add workflow cyberduck-release-windows
RaveenaRamany Dec 10, 2023
8795297
Fix missing transforms
RaveenaRamany Dec 10, 2023
5bdd666
update Repository secrets
RaveenaRamany Dec 10, 2023
70e22c7
Fix secret names
RaveenaRamany Dec 10, 2023
b05f3ef
Change runner to github hosted windows runner
RaveenaRamany Dec 10, 2023
c7ad044
Fix typo in secret name
RaveenaRamany Dec 10, 2023
e9297de
Merge pull request #2 from RaveenaRamany/convert-cyberduck-release-wi…
RaveenaRamany Dec 10, 2023
f67f6ef
Add option for git tag
RaveenaRamany Dec 10, 2023
3404b02
Merge pull request #3 from RaveenaRamany/features/migration-cyberduck…
RaveenaRamany Dec 10, 2023
547c0b8
Fix WORKSPACE variable
RaveenaRamany Dec 10, 2023
9f7cd51
Merge pull request #4 from RaveenaRamany/features/migration-cyberduck…
RaveenaRamany Dec 10, 2023
0689757
Fix sparkle updater certificate path
RaveenaRamany Dec 10, 2023
67679c0
Add quotes
RaveenaRamany Dec 10, 2023
60255dc
env test
RaveenaRamany Dec 10, 2023
5cbf6d6
env test
RaveenaRamany Dec 10, 2023
07fed6c
env test
RaveenaRamany Dec 10, 2023
7a6faaa
Fix environment variables
RaveenaRamany Dec 10, 2023
9a129dd
Fix maven-settings-action
RaveenaRamany Dec 10, 2023
e175cf7
Fix maven settings.xml
RaveenaRamany Dec 10, 2023
52633d0
Add workflow cyberduck-release-windows-chocolatey
RaveenaRamany Dec 11, 2023
b415011
Merge pull request #5 from RaveenaRamany/convert-cyberduck-release-wi…
RaveenaRamany Dec 11, 2023
dc9cbb6
comment env-key
RaveenaRamany Dec 11, 2023
4750959
Update cyberduck-release-windows-chocolatey.yml
RaveenaRamany Dec 12, 2023
06ca975
fix Variable GITHUB_REPOSITROY
RaveenaRamany Dec 14, 2023
40c20d8
update runs-on
RaveenaRamany Dec 14, 2023
6132d45
Merge branch 'iterate-ch:master' into master
RaveenaRamany Dec 14, 2023
1e30dc4
Merge pull request #6 from RaveenaRamany/features/migration-cyberduck…
RaveenaRamany Dec 14, 2023
afc920c
Merge branch 'iterate-ch:master' into master
RaveenaRamany Jan 3, 2024
b8f7da7
draft main.yml
RaveenaRamany Jan 11, 2024
0a8cdbb
added if condition
RaveenaRamany Jan 11, 2024
11d5fc3
added workflow template
RaveenaRamany Jan 19, 2024
270fc41
Chanced schedule time
RaveenaRamany Jan 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/cyberduck-release-windows-chocolatey.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: cyberduck-release-windows-chocolatey
on:
workflow_dispatch:
env:
CHOCOLATEY_API: "${{ secrets.CHOCOLATEY_API_KEY }}"
# # TimestamperBuildWrapper was not converted because the behavior is available by default in GitHub Actions and/or it is not configurable
jobs:
build:
runs-on:
- windows-latest
steps:
- name: checkout
uses: actions/checkout@v4.1.0
- name: run batch command
shell: cmd
run: FOR %%c in ("%GITHUB_REPOSITORY%\..\cyberduck-release-windows\windows\target\release\cyberduck.*.nupkg") DO C:\ProgramData\chocolatey\bin\cpush --verbose --api-key %CHOCOLATEY_API% %%c
# # Mailer plugin was not converted because GitHub Actions will email the actor after failed build and does not support emailing a list of recipients


160 changes: 160 additions & 0 deletions .github/workflows/cyberduck-release-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: cyberduck-release-windows
on:
workflow_dispatch:
inputs:
GIT_TAG:
required: false
env:
AWS_ACCESS_KEY_DEPLOYMENT: "${{ secrets.AWS_ACCESS_KEY_DEPLOYMENT }}"
AWS_SECRET_KEY_DEPLOYMENT: "${{ secrets.AWS_SECRET_KEY_DEPLOYMENT }}"
RACKSPACE_USER: "${{ secrets.RACKSPACE_USER }}"
RACKSPACE_PASSWORD: "${{ secrets.RACKSPACE_PASSWORD }}"

jobs:
build:
runs-on:
- windows-latest
steps:
- name: clean workspace
shell: ruby {0}
run: |-
require "fileutils"
Dir.chdir(ENV["GITHUB_WORKSPACE"]) do
paths = Dir.glob(["**/*"])
paths -= Dir.glob([".git/**", ".repository/**"])
paths.each do |path|
File.delete(path) if File.file?(path)
FileUtils.rm_rf(path) if File.directory?(path)
end
end
- name: checkout
uses: actions/checkout@v4.1.0
with:
ref: ${{ inputs.GIT_TAG }}
- name: Copy Sparkle Updater Private Key (DSA)
shell: powershell
env:
SPARKLE_UPDATER_PK: ${{ secrets.WIN_SPARKLE_UPDATER_PRIVATE_KEY }}
run: ${env:SPARKLE_UPDATER_PK} > "${env:GITHUB_WORKSPACE}\www\update\private.pem"

- name: Set up JDK 17
uses: actions/setup-java@v4.0.0
with:
distribution: 'temurin'
java-version: '17'
settings-path: "${{ github.workspace }}"
- name: Generate maven settings.xml
uses: s4u/maven-settings-action@v2.8.0
with:
servers: |
[{
"id": "maven.iterate.ch-release",
"username": "AKIAI44PZB4OH5YGWFVA",
"password": "${{ secrets.MAVEN_SERVER_PASSWORD }}"
},
{
"id": "maven.iterate.ch-snapshot",
"username": "AKIAI44PZB4OH5YGWFVA",
"password": "${{ secrets.MAVEN_SERVER_PASSWORD }}"
},
{
"id": "maven.cyberduck.io-release",
"username": "AKIAI44PZB4OH5YGWFVA",
"password": "${{ secrets.MAVEN_SERVER_PASSWORD }}"
},
{
"id": "maven.cyberduck.io-snapshot",
"username": "AKIAI44PZB4OH5YGWFVA",
"password": "${{ secrets.MAVEN_SERVER_PASSWORD }}"
}]
- name: Run maven
run: mvn clean deploy --settings ${env:GITHUB_WORKSPACE}/settings.xml -DskipTests -D"sparkle.feed="
- name: run batch command
shell: cmd
run: FOR %%c in ("%GITHUB_WORKSPACE%\windows\target\release\Cyberduck-*") DO "C:\Program Files\Cyberduck CLI\duck.exe" --upload rackspace:/cdn.cyberduck.ch/ "%%c" --username %RACKSPACE_USER% --password %RACKSPACE_PASSWORD% --retry --quiet --existing overwrite --region DFW
- name: run batch command
shell: cmd
run: FOR %%c in ("%GITHUB_WORKSPACE%\windows\target\release\Cyberduck-*") DO "C:\Program Files\Cyberduck CLI\duck.exe" --upload s3:/release.cyberduck.io/ "%%c" --username %AWS_ACCESS_KEY_DEPLOYMENT% --password %AWS_SECRET_KEY_DEPLOYMENT% --retry --quiet --existing overwrite --region us-east-1
- name: Upload Artifacts
uses: actions/upload-artifact@v3.1.3
if: always()
with:
path: |-
windows\target\release\*.exe
windows\target\release\*.msi
windows\target\release\*.appx
!**/*~
!**/#*#
!**/.#*
!**/%*%
!**/._*
!**/CVS
!**/CVS/**
!**/.cvsignore
!**/SCCS
!**/SCCS/**
!**/vssver.scc
!**/.svn
!**/.svn/**
!**/.DS_Store
!**/.git
!**/.git/**
!**/.gitattributes
!**/.gitignore
!**/.gitmodules
!**/.hg
!**/.hg/**
!**/.hgignore
!**/.hgsub
!**/.hgsubstate
!**/.hgtags
!**/.bzr
!**/.bzr/**
!**/.bzrignore
# # Fingerprinter was not converted because the behavior is available by default in GitHub Actions and/or it is not configurable
# # Mailer plugin was not converted because GitHub Actions will email the actor after failed build and does not support emailing a list of recipients
# Ensure parameter if_key_exists is set correctly
- name: Install SSH key
uses: shimataro/ssh-key-action@v2.6.1
with:
key: "${{ secrets.VERSION_CYBERDUCK_IO_SSH_KEY }}"
name: id_rsa-version_cyberduck_io
known_hosts: "${{ secrets.VERSION_CYBERDUCK_IO_KNOWN_HOSTS }}"
if_key_exists: replace # replace will allow us to update the ssh-key on an existing build
config: |
Host VERSION_CYBERDUCK_IO
HostName ${{ secrets.VERSION_CYBERDUCK_IO_HOST_NAME }}
User ${{ secrets.VERSION_CYBERDUCK_IO_USER }}
IdentityFile ~/.ssh/id_rsa-version_cyberduck_io
if: always()
- name: setup file transfer file
uses: actions/github-script@v7.0.0
with:
script: |-
const fs = require('fs').promises
const path = require('path')
const patterns = "windows/target/update/changelog.*,!**/*~,!**/#*#,!**/.#*,!**/%*%,!**/._*,!**/CVS,!**/CVS/**,!**/.cvsignore,!**/SCCS,!**/SCCS/**,!**/vssver.scc,!**/.svn,!**/.svn/**,!**/.DS_Store,!**/.git,!**/.git/**,!**/.gitattributes,!**/.gitignore,!**/.gitmodules,!**/.hg,!**/.hg/**,!**/.hgignore,!**/.hgsub,!**/.hgsubstate,!**/.hgtags,!**/.bzr,!**/.bzr/**,!**/.bzrignore"
const globber = await glob.create(patterns.replace(/,/g, "\n"))
const files = []
for await (const file of globber.globGenerator()) {
if ((await fs.lstat(file)).isDirectory()) continue
files.push(path.relative(process.cwd(), file))
}
fs.writeFile("version_cyberduck_io-transfer.txt", files.join("\n"), (err) => {})
if: always()
- name: run file transfers
run: |-
ssh VERSION_CYBERDUCK_IO 'mkdir -p windows'
tar -cvf version_cyberduck_io-transfer.tar --files-from version_cyberduck_io-transfer.txt
scp version_cyberduck_io-transfer.tar VERSION_CYBERDUCK_IO:
ssh VERSION_CYBERDUCK_IO 'tar -xvf version_cyberduck_io-transfer.tar -C windows && rm version_cyberduck_io-transfer.tar'
if: always()
# # This item has no matching transformer
# - uses: hudson.tasks.BuildTrigger
# with:
# childProjects: cyberduck-release-windows-chocolatey
# threshold:
# name: SUCCESS
# ordinal: '0'
# color: BLUE
# completeBuild: 'true'
42 changes: 42 additions & 0 deletions .github/workflows/template-konzept.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: template-konzept

on:
schedule:
- cron: '0 18 * * *'
release:
types: [published, prereleased]

jobs:
set_variables_job:
runs-on: ubuntu-latest
outputs:
VariablePre: ${{steps.set_vars_schedule.outputs.VARIABLEPRE}}
VariableRel: ${{steps.set_vars_schedule.outputs.VARIABLEREL}}
VariableTim: ${{steps.set_vars_schedule.outputs.VARIABLETIM}}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set variables
id: set_vars_schedule
run: |
if [[ "${{ github.event_name }}" = "schedule" ]]
then
echo "VARIABLETIM=IT IS TIMEBASED! " >> "$GITHUB_OUTPUT"
fi
if [[ "${{ github.event_name }}" = "release" ]]
then
if "${{ github.event.release.prerelease }}"
then
echo "VARIABLEPRE=IT IS A PRERELEASE!" >> "$GITHUB_OUTPUT"
else
echo "VARIABLEREL=IT IS A RELEASE!" >> "$GITHUB_OUTPUT"
fi
fi

call_resuable_job:
needs: set_variables_job
uses: ./.github/workflows/template-reusable.yml
with:
variablePre: ${{needs.set_variables_job.outputs.VariablePre}}
variableRel: ${{needs.set_variables_job.outputs.VariableRel}}
variableTim: ${{needs.set_variables_job.outputs.VariableTim}}
25 changes: 25 additions & 0 deletions .github/workflows/template-reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: template-reusable

on:
workflow_call:
inputs:
variablePre:
required: true
type: string
variableRel:
required: true
type: string
variableTim:
required: true
type: string


jobs:
my_job:
runs-on: ubuntu-latest
steps:
- name: Print variables
run: |
echo "Prerelease: ${{ inputs.variablePre }}"
echo "Release: ${{ inputs.variableRel }}"
echo "Time: ${{ inputs.variableTim }}"
6 changes: 4 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -859,12 +859,14 @@
<distributionManagement>
<repository>
<id>maven.cyberduck.io-release</id>
<url>s3://repo.maven.cyberduck.io/releases/</url>
<!-- <url>s3://repo.maven.cyberduck.io/releases/</url>
-->
<url>file://${user.home}</url>
<layout>default</layout>
</repository>
<snapshotRepository>
<id>maven.cyberduck.io-snapshot</id>
<url>s3://repo.maven.cyberduck.io/snapshots/</url>
<url>file://${user.home}</url>
</snapshotRepository>
<site>
<id>github-pages-site</id>
Expand Down