Skip to content

Commit

Permalink
Merge pull request #42 from gumob:develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
gumob authored Aug 27, 2024
2 parents 2d55cfc + 1ce7a45 commit 2425c87
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 31 deletions.
88 changes: 61 additions & 27 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,18 @@ on:
paths:
- .github/workflows/**
- .swiftlint.yml
- Cartfile
- Package.swift
- TLDExtractSwift.podspec
- TLDExtractSwift.xcodeproj/**
- Sources/**
- Tests/**
# pull_request:
# branches:
# - develop
# # branches-ignore:
# # - "release/**"
# # - "feature/**"
# paths:
# - .github/workflows/**
# - .swiftlint.yml
# - Package.swift
# - TLDExtractSwift.podspec
# - TLDExtractSwift.xcodeproj/**
# - Sources/**
# - Tests/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# lint_code:
# name: Lint Code
# runs-on: macos-14
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Install SwiftLint
# run: brew install swiftlint
# - name: Lint
# run: |
# set -o pipefail
# swiftlint lint --quiet | sed -E 's/^(.*):([0-9]+):([0-9]+): (warning|error|[^:]+): (.*)/::\4 title=Lint error,file=\1,line=\2,col=\3::\5\n\1:\2:\3/'

lint_code:
name: Lint Code
runs-on: ubuntu-latest
Expand Down Expand Up @@ -422,3 +396,63 @@ jobs:
# pod repo update
# pod trunk push TLDExtractSwift.podspec --allow-warnings
needs: carthage

update_tag:
if: github.ref == 'refs/heads/main'
runs-on: macOS-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Extract version and add tag
uses: actions/github-script@v7
with:
script: |
// Import the exec function from the child_process module to execute shell commands
const { exec } = require('child_process');
// Execute the command to get the build settings and filter for MARKETING_VERSION
exec('xcodebuild -showBuildSettings | grep MARKETING_VERSION', (error, stdout, stderr) => {
// Check for errors in executing the command
if (error) {
console.error(`Error: ${error.message}`);
return;
}
// Check for any standard error output
if (stderr) {
console.error(`Error: ${stderr}`);
return;
}
// Extract the current version from the command output
const current_version = stdout.trim().split('=')[1].trim();
// If a current version is found
if (current_version && /^\d+\.\d+\.\d+$/.test(current_version)) {
// Check if a tag with the current version already exists
exec(`git tag -l | grep ${current_version}`, (error, stdout) => {
// If the tag exists, delete it both locally and remotely
if (stdout) {
exec(`git tag -d ${current_version} && git push origin :refs/tags/${current_version}`, (error) => {
if (error) {
console.error(`Error: ${error.message}`);
return;
}
});
}
// Create a new tag with the current version and push it to the remote repository
exec(`git tag ${current_version} && git push origin ${current_version}`, (error) => {
if (error) {
console.error(`Error: ${error.message}`);
return;
}
});
});
} else {
// If no version could be retrieved, log an error message
console.error('Could not retrieve version.');
}
});
needs: cocoapods
8 changes: 4 additions & 4 deletions TLDExtractSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 3.0.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
PRODUCT_BUNDLE_IDENTIFIER = com.gumob.TLDExtractSwift;
Expand Down Expand Up @@ -497,7 +497,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 3.0.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
PRODUCT_BUNDLE_IDENTIFIER = com.gumob.TLDExtractSwift;
Expand Down Expand Up @@ -528,7 +528,7 @@
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 3.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.gumob.TLDExtractSwiftTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand All @@ -555,7 +555,7 @@
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 3.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.gumob.TLDExtractSwiftTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand Down

0 comments on commit 2425c87

Please sign in to comment.