Skip to content

Adding version 1 of the lock file #141

Adding version 1 of the lock file

Adding version 1 of the lock file #141

name: Zip MySQL scripts
permissions:
contents: write
packages: write
'on':
workflow_dispatch: {}
push:
branches:
- main
paths:
- '**/*'
- '!.github/badges/*'
- '!README.md'
- '!python/**/*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set Version
run: echo "PACKAGE_VERSION=$(date +'%Y.%m.%d').$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
- name: Zip files
uses: vimtor/action-zip@v1.2
with:
files: mysql
dest: octopub.mysql.flyway.${{ env.PACKAGE_VERSION }}.zip
- name: Create settings.xml
shell: pwsh
run: |
Write-Host "Creating settings.xml file"
$fileContent =
@"
<settings>
<servers>
<server>
<id>octopus-sales-public-snapshot</id>
<filePermissions>PublicRead</filePermissions>
<username>${{ secrets.AWS_ACCESS_KEY_ID }}</username>
<password>${{ secrets.AWS_SECRET_ACCESS_KEY }}</password>
<configuration>
<region>ap-southeast-2</region>
<publicRepository>true</publicRepository>
</configuration>
</server>
<server>
<id>octopus-sales-public-release</id>
<filePermissions>PublicRead</filePermissions>
<username>${{ secrets.AWS_ACCESS_KEY_ID }}</username>
<password>${{ secrets.AWS_SECRET_ACCESS_KEY }}</password>
<configuration>
<region>ap-southeast-2</region>
<publicRepository>true</publicRepository>
</configuration>
</server>
</servers>
</settings>
"@
Set-Content -Path "settings.xml" -Value $fileContent
- name: Write pom.xml
shell: pwsh
run: |
Write-Host "Creating pom.xml file"
$fileContent =
@"
<project>
<groupId>com.octopus</groupId>
<artifactId>octopub.mysql.flyway</artifactId>
<version>${{ env.PACKAGE_VERSION }}</version>
<modelVersion>4.0.0</modelVersion>
<build>
<extensions>
<extension>
<groupId>com.github.seahen</groupId>
<artifactId>maven-s3-wagon</artifactId>
<version>1.3.3</version>
</extension>
</extensions>
</build>
<distributionManagement>
<repository>
<id>maven.nuvalence.repo</id>
<url>s3://octopus-sales-public-maven-repo/snapshot</url>
</repository>
<snapshotRepository>
<id>maven.nuvalence.repo</id>
<url>s3://octopus-sales-public-maven-repo/snapshot</url>
</snapshotRepository>
</distributionManagement>
</project>
"@
Set-Content -Path pom.xml -Value $fileContent
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
architecture: x64
- name: Run maven build
run: mvn deploy:deploy-file --settings settings.xml -DgroupId=com.octopus -DartifactId=octopub.mysql.flyway -Dversion=${{ env.PACKAGE_VERSION }} -Dpackaging=zip -Dfile=octopub.mysql.flyway.${{ env.PACKAGE_VERSION }}.zip -DrepositoryId=octopus-sales-public-snapshot -Durl=s3://octopus-sales-public-maven-repo/snapshot
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: ap-southeast-2
# - name: Upload artifact
# uses: usualdesigner/s3-artifact-upload@main
# with:
# bucket-name: octopus-sales-public-maven-repo
# file: octopub.mysql.flyway.${{ env.PACKAGE_VERSION }}.zip