Skip to content

Commit

Permalink
workflow yml files edited
Browse files Browse the repository at this point in the history
  • Loading branch information
fam007e committed Oct 1, 2024
1 parent 2574fcc commit 832658e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build-secpasswd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
run: |
if [ -f "securepass" ]; then
echo "::set-output name=artifact_exists::true"
echo "::set-output name=version::$(./securepass --version | awk '{print $NF}')"
else
echo "::set-output name=artifact_exists::false"
fi
Expand All @@ -56,8 +57,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.SECPASSWD_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release ${{ github.run_number }}
tag_name: v${{ steps.check_artifacts.outputs.version }}
release_name: Release ${{ steps.check_artifacts.outputs.version }}
draft: false
prerelease: false

Expand All @@ -76,4 +77,4 @@ jobs:
if: failure()
run: |
echo "Build or tests failed. Please check the logs for more information."
exit 1
exit 1
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@ jobs:
run: |
mkdir -p release
cp securepass release/
tar -czvf release/securepass-$(date +'%Y.%m.%d').tar.gz release/securepass
version=$(./securepass --version | awk '{print $NF}')
tar -czvf release/securepass-${version}.tar.gz release/securepass
- name: Create release
id: create_release
run: |
version=$(date +'%Y.%m.%d')
version=$(./securepass --version | awk '{print $NF}')
changelog=$(git log --oneline --pretty=format:"* %s (%h)" | head -n 20)
echo "Changelog: $changelog" > release/changelog.txt
gh release create "v${version}.$(git rev-list --count HEAD)" release/securepass-${version}.tar.gz release/changelog.txt --title "Release v${version}.$(git rev-list --count HEAD)" --notes "$changelog"
gh release create "v${version}" release/securepass-${version}.tar.gz release/changelog.txt --title "Release v${version}" --notes "$changelog"
- name: Clean up
run: |
rm -rf release
rm -rf release
19 changes: 6 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ CC = gcc
CFLAGS = -Wall -Wextra -I./src -I/usr/include
LDFLAGS = -lcrypto -loath -lssl

# Version definition
VERSION := $(shell date +%Y.%m.%d)
CFLAGS += -DVERSION=\"$(VERSION)\"

# Check if oath.h exists in the system
OATH_SYSTEM := $(shell if [ -f /usr/include/liboath/oath.h ]; then echo 1; else echo 0; fi)

Expand All @@ -14,12 +18,7 @@ SRCS = src/main.c src/encryption.c src/csv_handler.c src/totp.c src/utils.c
OBJS = $(SRCS:.c=.o)
TARGET = securepass

# Test source files (add your test files here)
TEST_SRCS = tests/test_main.c
TEST_OBJS = $(TEST_SRCS:.c=.o)
TEST_TARGET = run_tests

.PHONY: all clean test
.PHONY: all clean

all: $(TARGET)

Expand All @@ -29,11 +28,5 @@ $(TARGET): $(OBJS)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

test: $(TEST_TARGET)
./$(TEST_TARGET)

$(TEST_TARGET): $(filter-out src/main.o, $(OBJS)) $(TEST_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

clean:
rm -f $(OBJS) $(TEST_OBJS) $(TARGET) $(TEST_TARGET)
rm -f $(OBJS) $(TARGET)

0 comments on commit 832658e

Please sign in to comment.